" A function to search for words after {marker_text} and add them to local " spell file function! AutoSpellGoodWords(marker_text) call cursor(1, 1) " let l:marker_text = '"%% LocalWords:' let l:marker_text = a:marker_text let l:lines = [] let l:goodwords_start = search(l:marker_text, 'cW') let l:line = getline(l:goodwords_start) let l:header = strpart(l:line, 0, strlen(l:marker_text)) if l:header == l:marker_text call insert(l:lines, l:line) endif while l:goodwords_start > 0 let l:goodwords_start = search(l:marker_text, 'W') if l:goodwords_start == 0 break end let l:line = getline(l:goodwords_start) let l:header = strpart(l:line, 0, strlen(l:marker_text)) if l:header == l:marker_text call insert(l:lines, l:line) endif endwhile let l:words = [] for l:line in l:lines let l:line = strpart(l:line, strlen(l:marker_text) + 1) call extend(l:words, split(l:line)) endfor for l:word in l:words silent execute ':spellgood! ' . l:word endfor endfunction autocmd FileType tex call AutoSpellGoodWords('%% LocalWords:')
Tag: programming
Install mercurial and hg-git
sudo apt-get install mercurial
sudo apt-get install mercurial-git
Note: The version of mercurial should be >= 2.8.
If the default version of mercurial in apt-get is < 2.8. You can install using pip
sudo pip install mercurial –upgrade
You need to create a repo on Github.com
Clone your bitbucket repo
hg clone https://hbhzwj@bitbucket.org/hbhzwj/sadit hg-repo
Convert hg repo to git repo
Hg-Git can also be used to convert a Mercurial repository to Git. You can use a local repository or a remote repository accessed via SSH, HTTP or HTTPS. Use the following commands to convert the repository
$ mkdir git-repo; cd git-repo; git init; cd ..
$ cd hg-repo
$ hg bookmarks hg
$ hg push ../git-repo
The hg bookmark is necessary to prevent problems as otherwise hg-git pushes to the currently checked out branch confusing Git. This will create a branch named hg in the Git repository. To get the changes in master use the following command (only necessary in the first run, later just use git merge or rebase).
$ cd git-repo
$ git checkout -b master hg
Push the Git repo to Github Server
cd git-repo;
git remote add origin <github-url>;
git push -u origin master;
cd ..;
I also write a script to do this automatically.
Ubuntu in Mac book pro
If you want to install ubuntu in Macbook pro. plese refer the following webpage
https://help.ubuntu.com/community/MacBookPro
be attention that, if you want to have the right resolution, download the driver from the nvidia offical site and don’t use the nvidia-current in apt-get, it will crash the GUI.
if you have installed nvidia-current and cannnot enter the GUI, just delete /etc/X11/xorg.conf and then type startx in the command window. then you will enter a GUI with low resolution interface. Then download the nvidia driver from official site and reinstall again.