Building Remote+Local *nix Develop Environment(II)

This is the second article(collection) on how
to build a *nix development
environment by integrating remote
servers and local Linux/Mac clients. For the previous article on this topic, please refer to Building
Remote+Local *nix Develop Environment
.

1. Vim Tips & Plugins

1.1 Highlight All Instances of Word Under Cursor

Add following line into your $HOME/.vimrc

  1. autocmd CursorMoved * exe printf(‘match IncSearch /\V\<%s\>/‘, escape(expand(‘<cword>‘), ‘/\‘))

Or use a more complicated one in the .vimrc:

  1. " Highlight all instances of word under cursor, when idle.
  2. " Useful when studying strange source code.
  3. " Type z/ to toggle highlighting on/off.
  4. nnoremap z/ :if AutoHighlightToggle()<Bar>set hls<Bar>endif<CR>
  5. function! AutoHighlightToggle()
  6. let @/ = ‘‘
  7. if exists(‘#auto_highlight‘)
  8. au! auto_highlight
  9. augroup! auto_highlight
  10. setl updatetime=4000
  11. echo ‘Highlight current word: off‘
  12. return 0
  13. else
  14. augroup auto_highlight
  15. au!
  16. au CursorHold * let @/ = ‘\V\<‘.escape(expand(‘<cword>‘), ‘\‘).‘\>‘
  17. augroup end
  18. setl updatetime=500
  19. echo ‘Highlight current word: ON‘
  20. return 1
  21. endif
  22. endfunction

1.2 Automatically Load Ctags

If you have generated ctags file, then you can automatically load it by:

  • export CTAGS_TAG in $HOME/.bashrc by export
    CTAGS_TAG=/path/to/your/tags
    .
  • add following lines into your $HOME/.vimrc

```Shell

  1. if filereadable($CTAGS_TAG)
  2. set tags=$CTAGS_TAG
  3. endif

```

1.3 Most Recently Used(MRU) Files

If you want to access the most recently used files in Vim, you need plugin MRU. The :MRU command
will show you all the recently used files, and you can choose a file and press <Enter> to open it
in current window. In addition

  • To open a file
    from the MRU window
    in a new tab, press the t key.
  • You can open multiple files from the MRU window by specifying a
    count before pressing <Enter> or v or o or t.
  • You can close the MRU window by pressing the q key or the <Esc> key
    or using one of the Vim window commands.
  • You can specify a pattern to the :MRU command, such as :MRU
    <pattern>
    .

1.4 Pathogen

Vim runtimepath manager, widely used by many plugins. Adding call
pathogen#infect()
 to your .vimrc, then any plugins you wish to install can be extracted
to a subdirectory under ~/.vim/bundle. And they will be added to the runtimepath.

1.5 NERDTree & NERDTree
Tabs

The NERD tree allows you to explore your filesystem and to open files and directories, and NERDTree Tabs can make NERDTree available for all Vim tabs(sometimes it is useful). After installing the these plugins, you can add the following lines to .vimrc.

  1. " Nerd Tree
  2. " let g:NERDTreeDirArrows=0 " Do not use new arrows for directories
  3. map <C-n> :NERDTreeToggle<CR>
  4. let g:nerdtree_tabs_open_on_gui_startup=0 " no nerdtree_tabs by default

For some Linux distributions, the NERDTree could not show arrows for directories, then you need to uncomment the line let
g:NERDTreeDirArrows=0
 in your .vimrc.

1.6 Supertab

Supertab is a vim plugin which allows you to use <Tab> for all your insert completion needs
(:help ins-completion).

1.7 CtrlP & Command-T

These two plugins are used for searching/opening files(even not in ctags) in Vim. CtrlP is written in pure Vimscript, so it is very slow. Although Command-T is faster, it relies on Ruby, which makes it difficult to install. Actually, I rarely use them in daily
work.

My vimrc can be found at https://github.com/bo-yang/misc/blob/master/vimrc.

2. Cscope

Cscope is a tool for browsing source code. You can either run cscope standalone or use it
with Vim
. No matter in which way, you need to generate cscope database first. And the cscope DB depends on the source files you specified. General steps of using cscope are:

  1. find /my/project/dir -name ‘*.c‘ -o -name ‘*.h‘ > /foo/cscope.files
  2. cd /foo
  3. cscope -b
  4. CSCOPE_DB=/foo/cscope.out; export CSCOPE_DB

In Vim, you can load cscope DB by command :cs add <path_to_cscope_db>. For more cscope operations
in Vim, please run command :cs help. To automatically load cscope into Vim, you can export CSCOPE_DB in $HOME/.bashrc,
such as

  1. export CSCOPE_DB=/path/to/cscope.out

Then the CSCOPE_DB will be automatically loaded every time you run Vim.

To save the effort of building cscope DB, I wrote a cross-platform(Linux & Mac OS X) wrapper script, which can be found in my GitHub
channel
.

3. sshfs Wrapper

Since sshfs command requires too much parameters, and things will be worse when the network
is not stable. Following script will ease your pain.

  1. #!/bin/sh
  2. USER=<your_name>
  3. SERVER=<your_server>
  4. remote_dir=/nobackup/$USER
  5. local_dir=$HOME/Documents/VMs
  6. if [ ! -d ${local_dir} -o ! -s ${local_dir} ]
  7. then
  8. sudo umount -f $local_dir
  9. fi
  10. cd ${local_dir}
  11. sshfs [email protected]${SERVER}:${remote_dir} ${local_dir}

- See more at:
http://www.bo-yang.net/2014/12/19/remote-local-linux-develop-env-2/#sthash.7IdS3E6c.dpuf

时间: 2024-09-29 00:51:44

Building Remote+Local *nix Develop Environment(II)的相关文章

ubuntu14.04 android develop environment setup for android and linux driver

//For android and linux driver// 1,install ubuntu14.04 usb boot, CD boot, vmware workstation install, etc take usb boot for an example, download Universal-USB-Installer-1.9.5.6.exe and ubuntu-14.04.2-desktop-amd64.iso at windows xp platform. i take m

如何搭建maya plugin develop environment on MAC OS X

1.首先我使用的平台是xcode version 5.1.1 ,MAYA2015, MAX OS X 10.9.4. MAYA2015要求的是:Mountain Lion 10.8.5, Xcode 5.0.2 with SDK 10.8 (Mountain Lion), clang with libstdc++. 但是没有关系, 虽然xcode默认的工程编译sdk是10.9但是xcode 5.1.1是支持10.8的sdk的. 2. 在build setting 里面设置工程链接的lib的路径和

Basic Task List

参考: https://laravel.com/docs/5.2/quickstart#stubbing-the-routes Introduction This quickstart guide provides a basic introduction to the Laravel framework and includes content on database migrations, the Eloquent ORM, routing, validation, views, and B

LD_LIBRARY_PATH shouldn&#39;t contain the current directory when building glibc. Please change the envir

执行# ./glibc-2.14/configure 出现以下错误: checking LD_LIBRARY_PATH variable... contains current directory configure: error: *** LD_LIBRARY_PATH shouldn't contain the current directory when *** building glibc. Please change the environment variable *** and r

Android Programming: Pushing the Limits -- Chapter 1: Fine-Tuning Your Development Environment

ADB命令 Application Exerciser Monkey Gradle ProGuard 代码重用 版本控制 静态代码分析 代码重构 开发者模式   ADB命令: @.adb help:查看adb命令. @.adb devices:列出所有连接的安卓设备和模拟器. @.adb push <local> <remote> 把计算机里的文件拷贝到设备中. adb push e:\test.xml /sdcard/files.ldb/ @.adb pull <remot

atom通过remote ftp同步本地文件到远程主机的方法

视频教程:https://ninghao.net/video/3991 搜索 "remote ftp", 点击 "Package"搜索包,Install"安装 本地打开需要同步的项目目录 创建 remote-ftp 的配置文件,Packages -> Remote-ftp -> creadte SFTP config file 修改配置文件,将host,账号密码替换,sftp默认配置 { "protocol": "

Install Visual Studio Tools for Apache Cordova

Install Visual Studio Tools for Apache Cordova Visual Studio 2013 This article refers to the Visual Studio Tools for Apache Cordova, which is pre-release software. The features described are in preview and are subject to change. You can download the

Cocos2d-JS: 2.编译到安卓和iOS

上面介绍了项目的创建,这一节记录如何编译成安卓和iOS的app,这里先记录如何编译成iOS的. 1.首先在终端中进入到项目的目录下,先看下编译命令有哪些功能,运行cocos compile -h: 1 bogon:HelloC1 dn9x$ cocos compile -h 2 usage: cocos compile [-h] [-s SRC_DIR] [-q] [-p PLATFORM] [-m MODE] [-j JOBS] 3 [--ap ANDROID_PLATFORM] [--ndk

安卓003快速入门

笔记 一.Android概述 1.1 系统概述 1.1.1  3G ? 什么是3G    英文全称3rd-generation,第三代移动通信技术.是指将无线通信与国际互联网等多媒体通信结合的新一代移动通信系统.   * 3G制式: (欧洲版) WCDMA\HSDPA 中国联通采用 (北美版) CDMA 2000\EV-DO 中国电信采用 (中国版)TD-SCDMA\TD-HSDPA:中国移动采用 * 3G的发展:  1G:只能进行语音通话.模拟信号 2G:包括(GSM\GPRS\EDGE)增加