Welcome to the Treehouse Community
Looking to learn something new?
Getting started with vim!!
Hello everyone, So about 3 months ago, i heard about vim and was curious to find what it can do. I started taking python classes here at treehouse about a year ago and started working with IDEs (Integrated Development Environment) right after i was done with the classes. I looked around for some free/great IDEs and found that Pycharm was a match made in heaven. But after working with pycharm for the past 6 months, i wanted to increase my productivity. I looked around then found about vim. a searched around for some classes to begin with vim and mastering vim. After that i wanted to configure vim and tune it to my liking. So after lots of research, here come my vimrc file that i was working on. Its definitely not perfect for all of the people, but its a great place to get started from and its better than where i started. As stated above, Im a python programmer so this vimrc file is modeled for python development. There might be somethigs that you want to install for this to work flawlessly, like pathegon (https://github.com/tpope/vim-pathogen), vim-airline (https://github.com/vim-airline/vim-airline), and vundle vim (https://github.com/VundleVim/Vundle.vim).
Sooo with all of that talk, here's my vimrc file ;) :
syntax on syntax enable set number set showcmd set shiftwidth=4 set tabstop=4 set showmatch set background=dark set nocompatible set laststatus=2 set ignorecase set hlsearch set incsearch set smarttab set splitright filetype plugin indent on execute pathogen#infect() filetype off call vundle#begin() Plugin 'gmarik/Vundle.vim' call vundle#end() call plug#begin('~/.vim/plugged') call plug#end() let python_highlight_all = 1 au FileType python syn keyword pythonDecorator True None False self au BufNewFile,BufRead *.jinja set syntax=htmljinja au BufNewFile,BufRead *.mako set ft=mako au FileType python map <buffer> F :set foldmethod=indent<cr> au FileType python inoremap <buffer> $r return au FileType python inoremap <buffer> $i import au FileType python inoremap <buffer> $p print au FileType python inoremap <buffer> $f #--- <esc>a au FileType python map <buffer> <leader>1 /class au FileType python map <buffer> <leader>2 /def au FileType python map <buffer> <leader>C ?class au FileType python map <buffer> <leader>D ?def au FileType python set cindent au FileType python set cinkeys-=0# au FileType python set indentkeys-=0# " This line enables Fast saving nmap <leader>w :w!<cr> " This line od code will sudo save a file (Most likely won't work for windows ) " " :W sudo saves the file " " (useful for handling the permission-denied error) command W w !sudo tee % > /dev/null
If you have any problem/questions please please post them.
Best of luck, Ammar Fatihallah ?