Skip to content

Instantly share code, notes, and snippets.

@Johnytran
Johnytran / vim
Created September 26, 2015 04:52
my _vimrc
set nocompatible " be iMproved, required
filetype off " required
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
" Plugins
@Johnytran
Johnytran / nerdtree
Created September 19, 2015 06:04
open file in nerdtree
o: open in prev window
go: preview
t: open in new tab
T: open in new tab silently
i: open split
gi: preview split
s: open vsplit
gs: preview vsplit
@Johnytran
Johnytran / gist:65c697b90b56d3af0ed5
Created September 5, 2015 05:11
create new snippet by snipMate
You can add more file define syntax in folder of window
~\.vim\bundle\snipmate.vim\snippets
@Johnytran
Johnytran / snipmate
Created September 5, 2015 05:09
view instrution of snipMate in vim
:h snipMate for the filename syntax.
@Johnytran
Johnytran / window 8
Created September 5, 2015 04:51
key create folder
simply press Ctrl+Shift+N
@Johnytran
Johnytran / vim
Created August 30, 2015 10:29
view python version
vim --version | grep python
@Johnytran
Johnytran / nerdtree
Created August 30, 2015 01:57
Change CWD (current work directory) when navigate nerdtree
press key cd
@Johnytran
Johnytran / vim
Created August 29, 2015 13:03
combine NerdTree and CltrP
I found both the existing answers educational, and successfully combined the two so that the behavior is more like many people would expect from an IDE: Click on an open window/buffer, and have that file highlighted in the NERDTree. I put this in my ~/.vimrc:
autocmd BufEnter * if &modifiable | NERDTreeFind | wincmd p | endif
What this does:
autocmd BufEnter - runs every time you focus on a buffer (including the NERDTree window)
if &modifiable - when you do click the NERDTree window, do nothing else (the NERDTree window is not modifiable)
wincmd p - NERDTreeFind leaves the cursor focused on the NERDTree; this switches back to the window you'd originally focused on
Note that this won't work on any other buffer that isn't modifiable -- but that's generally a good thing; otherwise (for example) any time you got :help in vim, NERDTree would find and focus the directory where help files are stored--probably not something you want it to do.
@Johnytran
Johnytran / cmd
Created August 29, 2015 02:23
change default directory command prompt
1. You find the shortcut file of command prompt
Right click on the shortcut file to open the properties dialog. Inside the "Start in:" textbox you should see %HOMEDRIVE%%HOMEPATH%. If you want the prompt to start in C:\ just replace the variables with "C:\" (without quotes).
@Johnytran
Johnytran / nerdtree
Created August 23, 2015 04:47
Search file on nerdtree
1. Install Ack library
https://gist.github.com/Johnytran/4a91a0649e88ad5477c0
2. Install Plugin ack for nerdtree
https://github.com/mileszs/ack.vim/tree/master
(ack.vim/tree/master for vundle)