runtime ftplugin/man.vim " General settings set nocompatible " Disable compatibility with Vi set number " Show line numbers set relativenumber " Show relative line numbers set title " Set terminal title to the file name set bg=dark " Set dark background for better colors set laststatus=2 " Show the status line with detailed info set showmode " Show mode at the bottom set noshowcmd " Don't show partial commands at the bottom set ruler " Show line/column info at the bottom " Search and highlighting set nohlsearch " Disable search highlighting after search set ignorecase " Ignore case in search set smartcase " Make search case-sensitive if uppercase letters are used set incsearch " Incremental search as you type set wildignore=*.o,*.obj,*.bak,*.exe " Ignore certain file types in file completion " Indentation and formatting set autoindent " Enable automatic indentation set cindent " Enable C-style indentation set smartindent " Enable smart indentation (e.g., after braces) set nowrap " Disable line wrapping set scrolloff=8 " Keep the cursor in the middle set completeopt=menuone,noinsert " Make autocomplete in Python usable " Clipboard and mouse set clipboard+=unnamedplus " Enable clipboard integration with system clipboard set mouse=a " Enable mouse support for scrolling, selection, etc. " Session and history set viminfofile=~/.config/vim/.viminfo " Set the viminfo file location set viminfo='100,<50,s10,h " Clear Viminfo settings (no history saving) " File paths and runtime environment set runtimepath^=$HOME/.config/vim/.vim " Add custom runtime path for plugins and resources " Miscellaneous settings set go=a " Enable all automatic formatting options set spelllang=en,pl colorscheme pablo " Change colorscheme " Use pathogen (plugin manager) filetype off execute pathogen#infect() execute pathogen#helptags() syntax on filetype plugin on filetype plugin indent on " Automatically source .vimrc after saving autocmd BufWritePost ~/.vimrc source $MYVIMRC " Automatically source .inputrc after saving autocmd BufWritePost ~/.inputrc !bind -f ~/.inputrc " Automatically deletes all trailing whitespace and newlines at end of file on save. & reset cursor position autocmd BufWritePre * let currPos = getpos(".") autocmd BufWritePre * %s/\s\+$//e autocmd BufWritePre * %s/\n\+\%$//e autocmd BufWritePre * cal cursor(currPos[1], currPos[2]) " Mappings noremap dBx nnoremap s okzz " nnoremap S Ojzz nnoremap S :%s//g nnoremap Y y$ nnoremap - ddp nnoremap _ ddkP nnoremap "+yy nnoremap "+yW nnoremap "+p nnoremap i nnoremap :tabnew ~/.vimrc nnoremap :TlistToggle nnoremap :NERDTree " inoremap /<++>"_c4l vnoremap "+y " show existing tab with 4 spaces width set tabstop=4 " when indenting with '>', use 4 spaces width set shiftwidth=4 " On pressing tab, insert 4 spaces set expandtab " Compile R Markdown files with F5 autocmd Filetype rmd map :!echo"require(rmarkdown);render('%')"\|R--vanilla " Automatically use black on a Python file autocmd BufWritePost *.py !black --line-length=79 % " Run .py files automatically autocmd FileType python map :w:!python3 % " Pymode config let g:pymode = 1 let g:pymode_warnings = 0 let g:pymode_trim_whitespaces = 1 let g:pymode_options = 1 let g:pymode_options_max_line_length = 79 let g:pymode_options_colorcolumn = 1 let g:pymode_indent = 1 let g:pymode_indent_hanging_width = &shiftwidth let g:pymode_indent_hanging_width = 4 let g:pymode_doc = 1 let g:pymode_doc_bind = 'K' let g:pymode_rope = 1 let g:pymode_rope_autoimport = 1 let g:pymode_rope_lookup_project = 1 let g:pymode_rope_project_root = "." let g:pymode_rope_folder = ".ropeproject" let g:pymode_rope_completion = 1 let g:pymode_rope_complete_on_dot = 1 let maplocalleader = '\' " fzy integration function! FzyCommand(choice_command, vim_command) try let output = system(a:choice_command . " | fzy ") catch /Vim:Interrupt/ " Swallow errors from ^C, allow redraw! below endtry redraw! if v:shell_error == 0 && !empty(output) exec a:vim_command . ' ' . output endif endfunction nnoremap e :call FzyCommand("ag . --silent -l -g ''", ":e") nnoremap v :call FzyCommand("ag . --silent -l -g ''", ":vs") nnoremap s :call FzyCommand("ag . --silent -l -g ''", ":sp")