Fix for empty ident error using older git
In this snippet- Christian explains how to fix the empty ident error using a bleeding edge git. In older git versions this must be done manually. So if you get this error…
1 *** Environment problem: 2 *** Your name cannot be determined from your system services (gecos). 3 *** You would need to set GIT_AUTHOR_NAME and GIT_COMMITTER_NAME 4 *** environment variables; otherwise you won't be able to perform 5 *** certain operations because of "empty ident" errors. 6 *** Alternatively, you can use user.name configuration variable. 7 8 fatal: empty ident <.....@......com> not allowed
... then add the following parameters to your ~/.bashrc file and source it with . ~/.bashrc (or relogin, alternatively):
1 export GIT_AUTHOR_NAME="Marko Haapala" 2 export GIT_COMMITTER_NAME="Marko Haapala"
Linux here documents
Simple usage of a here document in Linux.
1 marko@x61s:~$ cat << EOF > /tmp/hubbabubba 2 > hubba 3 > EOF 4 marko@x61s:~$ cat /tmp/hubbabubba 5 hubba
Insert the contents of a file below the cursor
A clever way of inserting the contents of a file below the cursor.
1 :r /path/to/file.txt
A proper vim setup
Out-of-the-box vim setup is good, but with a few tweaks it gets much better. Install the full version instead of the minimal and also exuberant ctags, which are great for programmers using vim. They let you navigate in the source code like you do in a full fledged IDE .
1 sudo apt-get install vim exuberant-ctags
Then place the content below into your ~/.vimrc file.
1 set nocompatible 2 syntax on 3 filetype plugin indent on 4 runtime! macros/matchit.vim 5 set autoindent " always set autoindenting on 6 set smartindent " smartindent! :) 7 set nobackup " nobackup 8 :colorscheme oceandeep 9 augroup myfiletypes 10 " Clear old autocmds in group 11 autocmd! 12 " autoindent with two spaces, always expand tabs 13 autocmd FileType ruby,eruby,yaml set ai sw=2 sts=2 et 14 augroup END 15 16 17 " minibufexplorer options 18 let g:miniBufExplMapWindowNavVim = 1 19 let g:miniBufExplMapWindowNavArrows = 1 20 let g:miniBufExplMapCTabSwitchBufs = 1 21 let g:miniBufExplModSelTarget = 1 22 23 24 25 26 " Add the contents of this file to your ~/.vimrc file 27 " 28 " Crucual setting, set to the dir in which your ruby projects reside 29 30 let base_dir = "/work/aktagon/rails" . expand("%") 31 32 " Central additions (also add the functions below) 33 34 :command RTlist call CtagAdder("app/models","app/controllers","app/views","public") 35 36 map <F7> :RTlist<CR> 37 38 " Optional, handy TagList settings 39 40 :nnoremap <silent> <F8> :Tlist<CR> 41 42 let Tlist_Compact_Format = 1 43 let Tlist_File_Fold_Auto_Close = 1 44 45 let Tlist_Use_Right_Window = 1 46 let Tlist_Exit_OnlyWindow = 1 47 48 let Tlist_WinWidth = 40 49 50 " Function that gets the dirtrees for the provided dirs and feeds 51 " them to the TlAddAddFiles function below 52 53 func CtagAdder(...) 54 let index = 1 55 let s:dir_list = '' 56 while index <= a:0 57 let s:dir_list = s:dir_list . TlGetDirs(a:{index}) 58 let index = index + 1 59 endwhile 60 call TlAddAddFiles(s:dir_list) 61 wincmd p 62 exec "normal =" 63 wincmd p 64 endfunc 65 66 " Adds *.rb, *.rhtml and *.css files to TagList from a given list 67 " of dirs 68 69 func TlAddAddFiles(dir_list) 70 let dirlist = a:dir_list 71 let s:olddir = getcwd() 72 while strlen(dirlist) > 0 73 let curdir = substitute (dirlist, '|.*', "", "") 74 let dirlist = substitute (dirlist, '[^|]*|\?', "", "") 75 exec "cd " . g:base_dir 76 exec "TlistAddFiles " . curdir . "/*.rb" 77 exec "TlistAddFiles " . curdir . "/*.rhtml" 78 exec "TlistAddFiles " . curdir . "/*.css" 79 " exec "TlistAddFiles " . curdir . "/*.js" 80 endwhile 81 exec "cd " . s:olddir 82 endfunc 83 84 " Gets all dirs within a given dir, returns them in a string, 85 " separated by '|''s 86 87 func TlGetDirs(start_dir) 88 let s:olddir = getcwd() 89 exec "cd " . g:base_dir . '/' . a:start_dir 90 let dirlist = a:start_dir . '|' 91 let dirlines = glob ('*') 92 let dirlines = substitute (dirlines, "\n", '/', "g") 93 while strlen(dirlines) > 0 94 let curdir = substitute (dirlines, '/.*', "", "") 95 let dirlines = substitute (dirlines, '[^/]*/\?', "", "") 96 if isdirectory(g:base_dir . '/' . a:start_dir . '/' . curdir) 97 let dirlist = dirlist . TlGetDirs(a:start_dir . '/' . curdir) 98 endif 99 endwhile 100 exec "cd " . s:olddir 101 return dirlist 102 endfunc 103
Significantly speed up consequent ssh connections to the remote host
Achieve major speed up of e.g scp tab completions or other consequent connections to the same server by using ControlMaster. Append these rows into ~/.ssh/config
1 Host * 2 ControlMaster auto 3 ControlPath ~/.ssh/.sock_%r@%h:%p