You are not logged in.
Hello guys, I installed arch 2 days ago and it's been a blast so far! I am currently in the process of ricing my system and I have an idea that i would like to make possible. I am currently using rxvt-unicode as my terminal, zsh as my shell, I also installed a nice theme, a matching color scheme, and a custom font. However, I would like to use a different font in vim because it gets really annoying when you're dealing with huge amounts of code. Thanks in advanced.
Last edited by Malkawi (2016-11-27 12:40:55)
Offline
CHANGING FONTS
...
You can, however, switch fonts at runtime using escape sequences, e.g.:printf '\e]710;%s\007' "9x15bold,xft:Kochi Gothic"
Just add that to an alias or shell function to invoke vim.
Note that this will not work under terminal multiplexers (tmux/screen).
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
man urxvt wrote:CHANGING FONTS
...
You can, however, switch fonts at runtime using escape sequences, e.g.:printf '\e]710;%s\007' "9x15bold,xft:Kochi Gothic"
Just add that to an alias or shell function to invoke vim.
Note that this will not work under terminal multiplexers (tmux/screen).
Thanks a lot
Last edited by Malkawi (2016-11-26 18:20:31)
Offline
This might not be the right way to do it, however I'm still new to bash. I tried adding " alias vim='open "vim"'&&'printf '\e]710;%s\007' "9x15bold,xft:Kochi Gothic" ' " to my .zsh file but I get "~/.zshrc:91: command not found: printf e]710
~/.zshrc:fg:91: job not found: s007 "9x15bold,xft:Kochi Gothic" "
How can I fix this?
Offline
You need to escape the inner `'` quotes.
Offline
You need to escape the inner `'` quotes.
Escape?How?
Offline
Offline
Am I reading that wrong - as there is a lot more wrong with that than escaping quotes. That is unless aliases are completely different in zsh and bash.
First, I don't know what "open" is, and alias is usually just the commands you want it replaced with. And you need to put the printf command before vim, or you will not have the new font in vim. Then you probably want another printf command after vim to reset the font after vim exits. Lastly, 9x15bold,xft:Kochi Gothic is just the example in the man page - is that really the font you want to use?
Extra-lastly, you probably want this to be a function not an alias as you want to pass parameters to vim:
function vim() {
printf '\e]710;%s\007' "FONT-FOR-VIM"
/usr/bin/vim "$@"
printf '\e]710;%s\007' "YOUR-DEFAULT-FONT"
}
This would work for bash. I don't have any experience with zsh to know if the function would need to be written differently - but I don't think there are any bashisms, so it should all be POSIX sh anyways.
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
Am I reading that wrong - as there is a lot more wrong with that than escaping quotes. That is unless aliases are completely different in zsh and bash.
First, I don't know what "open" is, and alias is usually just the commands you want it replaced with. And you need to put the printf command before vim, or you will not have the new font in vim. Then you probably want another printf command after vim to reset the font after vim exits. Lastly, 9x15bold,xft:Kochi Gothic is just the example in the man page - is that really the font you want to use?
Extra-lastly, you probably want this to be a function not an alias as you want to pass parameters to vim:
function vim() { printf '\e]710;%s\007' "FONT-FOR-VIM" /usr/bin/vim "$@" printf '\e]710;%s\007' "YOUR-DEFAULT-FONT" }
This would work for bash. I don't have any experience with zsh to know if the function would need to be written differently - but I don't think there are any bashisms, so it should all be POSIX sh anyways.
Thanks for the reply mate, your command was able to change font of my terminal. However, vim doesn't start, it shows this error message instead. "vim:2: maximum nested function level reached"
Offline
It works fine here in bash. I did edit it a couple times, did you use the version you just quoted? That error sounds like the result of not having /usr/bin/ before vim in the function.
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
... or running the function from vim's init. where did you put the function?
Offline
I did think about putting the printf line in vimrc under an autocmd. My first attempts at that failed, and I suspected it might be a poor approach. The printf command needs to execute *before* vim starts up the ncurses alt screen. I don't know the order of events in vim startup, but I'm gathering that the screen may be initialized before the autocmds are executed. So - echoing the above - this must be a shell function, not a vim function.
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
It works fine here in bash. I did edit it a couple times, did you use the version you just quoted? That error sounds like the result of not having /usr/bin/ before vim in the function.
Ah my bad, I just noticed that. Thanks a lot for your help, but I have a small question: Do you have any resources on where I can start learning bash/general linux scripting in general? I really like customizing apps to my liking, and by the looks of it it seems like I'll be writing a lot of scripts/editing config files.
... or running the function from vim's init. where did you put the function?
I added the lines to my ~/.zshrc file.
Offline
Do you have any resources on where I can start learning bash/general linux scripting in general?
Offline
As suggested above, I can't offer guidance on zsh, but for bash or shell in general, see the wiki.
I'd suggest Greg's Wiki in particular.
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
As suggested above, I can't offer guidance on zsh, but for bash or shell in general, see the wiki.
I'd suggest Greg's Wiki in particular.
Well, Zsh is highly compatible with bash, I am basically using it as a better bash rn, thanks a lot for the links.
Hopefully one day I will be one of the people who answer questions in here instead of asking them.
Offline
I like Greg's wiki, it was really straightforward which was helpful when I was learning shell scripting
(I still basically always am learning)
Offline
I like Greg's wiki, it was really straightforward which was helpful when I was learning shell scripting
(I still basically always am learning)
Yeah the tutorials are really nice and well-structured.
Offline