Skip to content

Instantly share code, notes, and snippets.

@mborho
Last active April 21, 2017 13:43
Show Gist options
  • Save mborho/5353920 to your computer and use it in GitHub Desktop.
Save mborho/5353920 to your computer and use it in GitHub Desktop.
.vimrc
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
" Plugin 'tpope/vim-fugitive'
" plugin from http://vim-scripts.org/vim/scripts.html
" Plugin 'L9'
" Git plugin not hosted on GitHub
" Plugin 'git://git.wincent.com/command-t.git'
" git repos on your local machine (i.e. when working on your own plugin)
" Plugin 'file:///home/gmarik/path/to/plugin'
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
" Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" Install L9 and avoid a Naming conflict if you've already installed a
" different version somewhere else.
" Plugin 'ascenator/L9', {'name': 'newL9'}
" my plugins
" Plugin 'tmhedberg/SimpylFold'
Plugin 'vim-scripts/indentpython.vim'
Plugin 'bitc/vim-bad-whitespace'
Bundle 'Valloric/YouCompleteMe'
" https://github.com/Valloric/YouCompleteMe#ubuntu-linux-x64
"let g:ycm_autoclose_preview_window_after_completion=1
"map <leader>g :YcmCompleter GoToDefinitionElseDeclaration<CR>
""python with virtualenv support
"py << EOF
"import os
"import sys
"if 'VIRTUAL_ENV' in os.environ:
" project_base_dir = os.environ['VIRTUAL_ENV']
" activate_this = os.path.join(project_base_dir, 'bin/activate_this.py')
" execfile(activate_this, dict(__file__=activate_this))
"EOF
"Plugin 'scrooloose/syntastic'
"Plugin 'nvie/vim-flake8'
"let python_highlight_all=1
"syntax on
Plugin 'scrooloose/nerdtree'
Plugin 'jistr/vim-nerdtree-tabs'
let NERDTreeIgnore=['\.pyc$', '\~$'] "ignore files in NERDTree
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
" flag unnecessary whitespace
au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/
" show linenumbers
" set nu
set tabstop=4
set shiftwidth=4
set expandtab
" Enable folding
set foldmethod=indent
set foldlevel=99
" Enable folding with the spacebar
nnoremap <space> za
"
" autoindent on "
" set autoindent
" always show tabline "
set showtabline=1
" Set to auto read when a file is changed from the outside
set autoread
" Highlight search results
" set hlsearch "
" With a map leader it's possible to do extra key combinations
" like <leader>w saves the current file
let mapleader = ","
let g:mapleader = ","
" Fast saving
nmap <leader>w :w!<cr>
" Very fast saving
command W :w!
" tab-navigation
nnoremap <S-Tab> :tabprevious<CR>
nnoremap <Tab> :tabnext<CR>
" nnoremap <C-t> :tabnew<CR>
" nnoremap <C-w> :tabclose<CR>
" inoremap <S-Tab> <Esc>:tabprevious<CR>i
" inoremap <Tab> <Esc>:tabnext<CR>i
" inoremap <C-t> <Esc>:tabnew<CR>
" run last command "
nmap <leader>c :w<cr>:!!<cr>
" use ',ll' in nomral mode to sitch back to the latest viewed tab "
let g:lasttab = 1
nmap <leader>ll :exe "tabn ".g:lasttab<CR>
au TabLeave * let g:lasttab = tabpagenr()
map <leader>n <plug>NERDTreeTabsToggle<CR>
""""""""""""""""""""""""""""""
" => Highlighing
""""""""""""""""""""""""""""""
" Enable CursorLine
set cursorline
" Default Colors for CursorLine
highlight CursorLine ctermbg=Black ctermfg=None
" Change Color when entering Insert Mode
autocmd InsertEnter * highlight CursorLine guifg=white ctermbg=White ctermfg=Black
" Revert Color to default when leaving Insert Mode
autocmd InsertLeave * highlight CursorLine ctermbg=Black ctermfg=None
"set cursorline
"autocmd InsertEnter * highlight CursorLine guifg=white guibg=blue ctermfg=white ctermbg=blue
"autocmd InsertLeave * highlight CursorLine guifg=white guibg=darkblue ctermfg=white ctermbg=darkblue
""""""""""""""""""""""""""""""
" => Status line
""""""""""""""""""""""""""""""
" Always show the status line
set laststatus=2
" Format the status line
set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l/%c
" Returns true if paste mode is enabled
function! HasPaste()
if &paste
return 'PASTE MODE '
en
return ''
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment