Skip to main content

Posts

Showing posts with the label vim

Misc 20130401

To reset all shortcut definitions in evince, run rm ~/.config/evince/accels GCC would complain if you define a variable without actually using it. To silience it, use (void)var; DNS is not working in VirtualBox: Run VBoxManage modifyvm "VM name" --natdnshostresolver1 on Ref   A useful link talking about ravlue reference in C++11 http://thbecker.net/articles/rvalue_references/section_01.html   To clear disk cache in Linux: Run sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches' Ref  "screen-256color not found": Run infocmp xterm-256color > screen-256color.ti on a machine without this error, copy the file to the target machine and then run tic screen-256color.ti Ref Just switch to fcitx from ibus. I like a theme called 'anran'. If fcitx cannot follow the cursor on Firefox, turn on preedit, as said in the official wiki. Just played with a vim plugin called youcompleteme, for C++ autocomplete, which is quite powerful. Also I installed vund...

杂记 20130401

之前evince的快捷键乱套了,使用 rm ~/.config/evince/accels 复位 定义了变量var又不用的话,gcc会报warning"unused variable",解法是 (void)var; VirtualBox中DNS不工作:运行 VBoxManage modifyvm "VM name" --natdnshostresolver1 on Ref   一个讲c++11右值引用的link: http://thbecker.net/articles/rvalue_references/section_01.html   Linux清除disk cache: sudo sh -c 'echo 3 > /proc/sys/vm/drop_caches' Ref  遇到错误screen-256color not found需要支持新的终端类型:找一台支持screen-256color的机器执行 infocmp xterm-256color > screen-256color.ti 把文件拷贝到目标机器后执行 tic screen-256color.ti Ref  最近从ibus换到了fcitx,起初是由于sogou发布了,不过后来还是卸掉了。anran主题不错。fcitx在firefox中光标跟随有点问题,按官方wiki说法打开preedit后就没事了。  最近在vim里折腾youcompleteme这个补全插件,挺好用。顺便也装了vundle来管理插件,很不错  vim更新.vimrc后想直接应用,执行 so %

杂记 20111116 | Misc Notes 20111116

1.SingleCompile 是一个不错的 vim 插件,用于快速编译运行单个文件 2.vim 命令 :cope 查看所有编译错误 3.tsocks 从网络库层面给程序包装一个透明socks代理 4.删除 Messaging Menu 不需要的条目: mkdir -p ~/.config/indicators/messages/applications-blacklist/ 从 /usr/share/indicators/messages/applications 找到不需要的文件,在上面那个目录里创建链接 5.vim 的 wildmode 和 wildemenu 可以定制 vim 自动匹配(例如文件名)的模式 6.easytags 可以让vim根据tags进行语法高亮 7.让vim可以像Visual Studio一样在输入行末的分号或者右大括号时可以自动格式化代码 function! WL_auto_format() let curline = getline('.') let curcol = col('.') if match(curline[curcol :], '\S') == -1 " current char is curline[curcol-1] let c = curline[curcol-1] if c == ';' execute "normal \ =$" elseif c == '}' execute "normal =%%" endif endif endfunction autocmd Filetype c imap ; ; :call WL_auto_format() a autocmd Filetype c imap } } :call WL_auto_format() a autocmd Filetype cpp imap ; ; :call WL_auto_format() a autocmd Filetype cpp imap }...

solarized 颜色主题 | the solarized color theme

尽管之前杂记里提了一下,但是现在还是特别再记录一下。 其实是偶然从linuxtoy里的脚本看到了这个主题名字,感觉很漂亮。然后深入搜了一下。 这个主题对比度相对比较低,或者说亮度上的对比度比较低,而主要靠色相来提高肉眼辨识度。 另外它的一个精妙的地方在于,颜色经过精心挑选,不论是深色背景还是浅色的,前景色都能很好的显示 以下是各种链接,除了我提到了还有一些其他的(我不常用的和没听说过的) 主页: http://ethanschoonover.com/solarized 主git源: vim,emacs,mutt,gimp palette,Xresources https://github.com/altercation/solarized sigurdga的fork: gnome-terminal https://github.com/sigurdga/gnome-terminal-colors-solarized seebi的fork: dircolors, tmux https://github.com/seebi/solarized 我的fork: 256color for gnome-terminal and guake https://github.com/coolwanglu/gnome-terminal-colors-solarized 我的fork: Guake https://github.com/coolwanglu/guake-colors-solarized 说明 1. guake和gnome-terminal用的gconf类似,手工copy一下就行。不过我打算写个脚本,顺便学学git 2.terminal的主题一定要配合dircolors一起用,否则ls出来会很难看 3.vim里有多种选项可以配置主题 4. 原来gnome terminal那个是16色的port,我fork并改出一个256色的,另外加入了guake的支持 5.256色是终端不使用这个主题时的临时方法,所以我原来的理解有问题,于是分离出一个单独的guake源 Although I've already mentioned this theme in the previous misc notes, but now I've decided to introdu...

vim 让背景透明 | make transparent background in vim

gnome-terminal 背景默认是透明的了(至少是ubuntu下),guake也可以弄成透明的,但是vim我用了colorscheme torte,结果背景是一坨黑,很不爽。 最近研究了一下,命令应该是hi Normal ctermbg=NONE,而且应该放到torte.vim里(直接放vimrc中colorscheme的后面没有用,没有再仔细研究)。于是把torte.vim放到~/.vim/colors里,改名,把Normal一行的ctermbg设成None。就好了。 (当然vimrc里要加载这个新的颜色) 另外改guibg后gvim会报错,也没有再自己研究。我基本也不用gvim。 The background color of gnome-terminal has already been transparent, and so has guade. But (maybe since) I use 'colorscheme torte' for vim, the background is a huge black block, ugly... So I check the help page in vim and found the command should be 'hi Normal ctermbg=None', it's no use if put below the 'colorscheme' scheme in .vimrc, I have to change the color file. So I move the torte.vim in to my ~/.vim/colors, changed its name,and changed ctermbg to be 'NONE' at the line containing 'Normal'. Then it's done (of course you need to load this new scheme file in vimrc) Besides, gvim will show an error dialog if I set guibg to be NONE, don't k...