1833788 Members
2252 Online
110063 Solutions
New Discussion

.exrc

 
SOLVED
Go to solution
Simon Liu_2
Occasional Contributor

.exrc

I am using ksh. I want to pre-map a key (say c) with following operation:
map c :!fff^M (test run)
fff is the file name without extension (for example:fff.c), but i am editing the file with extension, how should i do? Since fff is changeable.

Thx
1 REPLY 1
curt larson_1
Honored Contributor
Solution

Re: .exrc

put this in your .exrc file
"
" G goes to end of file
" reads in ex command for writing to desired file name
" % is the primary file I'm editing
" basename strips the suffix .c from the file name
" "qdd deletes the command and puts it into the q named buffer
" *q executes the buffer
"
map key G^M:r! print ":w\! $(dirname %)/$(basename % .c)"^M"qdd^M*q^M