vim: how to record norm commands?
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
I edit and correct a lot of identical files
using those commands
:%norm f^ID
:%s/s+$//
:%norm A,
:%norm GG$x
I also used the macro mode
qa
for record macro a
and
@a
to execute
But for some strange reason
or probably my error
it applied only some commands
My question is: is possible to save
those command in a script
and use
vim -N -u NONE -n -c "set nomore" -S script.vi file.txt
Of course the syntax
:%norm f^ID
:%s/s+$//
:%norm A,
:%norm GG$x
Used in a script give me a error
Vim is 7.4 on slackware 14.2
vim macro
add a comment |Â
up vote
1
down vote
favorite
I edit and correct a lot of identical files
using those commands
:%norm f^ID
:%s/s+$//
:%norm A,
:%norm GG$x
I also used the macro mode
qa
for record macro a
and
@a
to execute
But for some strange reason
or probably my error
it applied only some commands
My question is: is possible to save
those command in a script
and use
vim -N -u NONE -n -c "set nomore" -S script.vi file.txt
Of course the syntax
:%norm f^ID
:%s/s+$//
:%norm A,
:%norm GG$x
Used in a script give me a error
Vim is 7.4 on slackware 14.2
vim macro
try-s ...
and add a:x
in the end. There is several options for sourcing files:-S ex-commands
(no ":") or-s vim-commands
â JJoao
Sep 26 '17 at 12:14
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I edit and correct a lot of identical files
using those commands
:%norm f^ID
:%s/s+$//
:%norm A,
:%norm GG$x
I also used the macro mode
qa
for record macro a
and
@a
to execute
But for some strange reason
or probably my error
it applied only some commands
My question is: is possible to save
those command in a script
and use
vim -N -u NONE -n -c "set nomore" -S script.vi file.txt
Of course the syntax
:%norm f^ID
:%s/s+$//
:%norm A,
:%norm GG$x
Used in a script give me a error
Vim is 7.4 on slackware 14.2
vim macro
I edit and correct a lot of identical files
using those commands
:%norm f^ID
:%s/s+$//
:%norm A,
:%norm GG$x
I also used the macro mode
qa
for record macro a
and
@a
to execute
But for some strange reason
or probably my error
it applied only some commands
My question is: is possible to save
those command in a script
and use
vim -N -u NONE -n -c "set nomore" -S script.vi file.txt
Of course the syntax
:%norm f^ID
:%s/s+$//
:%norm A,
:%norm GG$x
Used in a script give me a error
Vim is 7.4 on slackware 14.2
vim macro
vim macro
edited Sep 27 '17 at 19:51
asked Sep 26 '17 at 11:50
elbarna
3,83693577
3,83693577
try-s ...
and add a:x
in the end. There is several options for sourcing files:-S ex-commands
(no ":") or-s vim-commands
â JJoao
Sep 26 '17 at 12:14
add a comment |Â
try-s ...
and add a:x
in the end. There is several options for sourcing files:-S ex-commands
(no ":") or-s vim-commands
â JJoao
Sep 26 '17 at 12:14
try
-s ...
and add a :x
in the end. There is several options for sourcing files: -S ex-commands
(no ":") or -s vim-commands
â JJoao
Sep 26 '17 at 12:14
try
-s ...
and add a :x
in the end. There is several options for sourcing files: -S ex-commands
(no ":") or -s vim-commands
â JJoao
Sep 26 '17 at 12:14
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
1
down vote
This is not exactly what you asked, but you can create vim scripts with your content. Lets start with a simple case:
$ cat noendspaces
#!/usr/bin/vim -s
:%s/ *$//
:r ! echo "#last changed by $USER in :" `date`
:x
and then...
$ chmod 755 noendspaces
$ for a in file*.txt
do
./noendspaces $a
done
The syntax is ok,but doesn't work with norm commands,with other commands works but doesn't solve my problem
â elbarna
Sep 26 '17 at 15:35
@elbarna, I added a:%norm A,
to my script and it worked. Could you detail the "doesn't work with norm commands"
â JJoao
Sep 26 '17 at 18:10
I have tried the script with my file and it doesn't work,use the same commands one by one on vim work
â elbarna
Sep 27 '17 at 10:33
@elbarna, strange! 1) could you please checkwhich vim
? 2) please make a small test with: line1=#!/usr/bin/vim -s
, line 2=:%norm A,
and line 3=:x
and check if it adds ","
â JJoao
Sep 27 '17 at 10:54
vim 7.4 on Slackware 14.2
â elbarna
Sep 27 '17 at 19:51
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
This is not exactly what you asked, but you can create vim scripts with your content. Lets start with a simple case:
$ cat noendspaces
#!/usr/bin/vim -s
:%s/ *$//
:r ! echo "#last changed by $USER in :" `date`
:x
and then...
$ chmod 755 noendspaces
$ for a in file*.txt
do
./noendspaces $a
done
The syntax is ok,but doesn't work with norm commands,with other commands works but doesn't solve my problem
â elbarna
Sep 26 '17 at 15:35
@elbarna, I added a:%norm A,
to my script and it worked. Could you detail the "doesn't work with norm commands"
â JJoao
Sep 26 '17 at 18:10
I have tried the script with my file and it doesn't work,use the same commands one by one on vim work
â elbarna
Sep 27 '17 at 10:33
@elbarna, strange! 1) could you please checkwhich vim
? 2) please make a small test with: line1=#!/usr/bin/vim -s
, line 2=:%norm A,
and line 3=:x
and check if it adds ","
â JJoao
Sep 27 '17 at 10:54
vim 7.4 on Slackware 14.2
â elbarna
Sep 27 '17 at 19:51
add a comment |Â
up vote
1
down vote
This is not exactly what you asked, but you can create vim scripts with your content. Lets start with a simple case:
$ cat noendspaces
#!/usr/bin/vim -s
:%s/ *$//
:r ! echo "#last changed by $USER in :" `date`
:x
and then...
$ chmod 755 noendspaces
$ for a in file*.txt
do
./noendspaces $a
done
The syntax is ok,but doesn't work with norm commands,with other commands works but doesn't solve my problem
â elbarna
Sep 26 '17 at 15:35
@elbarna, I added a:%norm A,
to my script and it worked. Could you detail the "doesn't work with norm commands"
â JJoao
Sep 26 '17 at 18:10
I have tried the script with my file and it doesn't work,use the same commands one by one on vim work
â elbarna
Sep 27 '17 at 10:33
@elbarna, strange! 1) could you please checkwhich vim
? 2) please make a small test with: line1=#!/usr/bin/vim -s
, line 2=:%norm A,
and line 3=:x
and check if it adds ","
â JJoao
Sep 27 '17 at 10:54
vim 7.4 on Slackware 14.2
â elbarna
Sep 27 '17 at 19:51
add a comment |Â
up vote
1
down vote
up vote
1
down vote
This is not exactly what you asked, but you can create vim scripts with your content. Lets start with a simple case:
$ cat noendspaces
#!/usr/bin/vim -s
:%s/ *$//
:r ! echo "#last changed by $USER in :" `date`
:x
and then...
$ chmod 755 noendspaces
$ for a in file*.txt
do
./noendspaces $a
done
This is not exactly what you asked, but you can create vim scripts with your content. Lets start with a simple case:
$ cat noendspaces
#!/usr/bin/vim -s
:%s/ *$//
:r ! echo "#last changed by $USER in :" `date`
:x
and then...
$ chmod 755 noendspaces
$ for a in file*.txt
do
./noendspaces $a
done
edited Sep 26 '17 at 18:13
answered Sep 26 '17 at 12:05
JJoao
6,7211826
6,7211826
The syntax is ok,but doesn't work with norm commands,with other commands works but doesn't solve my problem
â elbarna
Sep 26 '17 at 15:35
@elbarna, I added a:%norm A,
to my script and it worked. Could you detail the "doesn't work with norm commands"
â JJoao
Sep 26 '17 at 18:10
I have tried the script with my file and it doesn't work,use the same commands one by one on vim work
â elbarna
Sep 27 '17 at 10:33
@elbarna, strange! 1) could you please checkwhich vim
? 2) please make a small test with: line1=#!/usr/bin/vim -s
, line 2=:%norm A,
and line 3=:x
and check if it adds ","
â JJoao
Sep 27 '17 at 10:54
vim 7.4 on Slackware 14.2
â elbarna
Sep 27 '17 at 19:51
add a comment |Â
The syntax is ok,but doesn't work with norm commands,with other commands works but doesn't solve my problem
â elbarna
Sep 26 '17 at 15:35
@elbarna, I added a:%norm A,
to my script and it worked. Could you detail the "doesn't work with norm commands"
â JJoao
Sep 26 '17 at 18:10
I have tried the script with my file and it doesn't work,use the same commands one by one on vim work
â elbarna
Sep 27 '17 at 10:33
@elbarna, strange! 1) could you please checkwhich vim
? 2) please make a small test with: line1=#!/usr/bin/vim -s
, line 2=:%norm A,
and line 3=:x
and check if it adds ","
â JJoao
Sep 27 '17 at 10:54
vim 7.4 on Slackware 14.2
â elbarna
Sep 27 '17 at 19:51
The syntax is ok,but doesn't work with norm commands,with other commands works but doesn't solve my problem
â elbarna
Sep 26 '17 at 15:35
The syntax is ok,but doesn't work with norm commands,with other commands works but doesn't solve my problem
â elbarna
Sep 26 '17 at 15:35
@elbarna, I added a
:%norm A,
to my script and it worked. Could you detail the "doesn't work with norm commands"â JJoao
Sep 26 '17 at 18:10
@elbarna, I added a
:%norm A,
to my script and it worked. Could you detail the "doesn't work with norm commands"â JJoao
Sep 26 '17 at 18:10
I have tried the script with my file and it doesn't work,use the same commands one by one on vim work
â elbarna
Sep 27 '17 at 10:33
I have tried the script with my file and it doesn't work,use the same commands one by one on vim work
â elbarna
Sep 27 '17 at 10:33
@elbarna, strange! 1) could you please check
which vim
? 2) please make a small test with: line1=#!/usr/bin/vim -s
, line 2=:%norm A,
and line 3=:x
and check if it adds ","â JJoao
Sep 27 '17 at 10:54
@elbarna, strange! 1) could you please check
which vim
? 2) please make a small test with: line1=#!/usr/bin/vim -s
, line 2=:%norm A,
and line 3=:x
and check if it adds ","â JJoao
Sep 27 '17 at 10:54
vim 7.4 on Slackware 14.2
â elbarna
Sep 27 '17 at 19:51
vim 7.4 on Slackware 14.2
â elbarna
Sep 27 '17 at 19:51
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f394517%2fvim-how-to-record-norm-commands%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
try
-s ...
and add a:x
in the end. There is several options for sourcing files:-S ex-commands
(no ":") or-s vim-commands
â JJoao
Sep 26 '17 at 12:14