Want to call windows applications from vim under cygwin [closed] - windows

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
I have vim and mintty installed with cygwin.
Have some aliases in bash profile, they work in terminal.
Then I call :!bash from vim, I have the same mintty terminal, but have to source .bash_profile again.
My original intent was to call command :!chrome %

In order to save some overhead, the default shell used by Vim to invoke external commands (i.e. via :! {cmd}) is a non-interactive one; it doesn't read the usual initialization files.
If you want to use shell aliases, you can reconfigure Vim to start an interactive one (adding the i flag):
:set shellcmdflag=-ic
Aliases are typically defined in .bashrc; however, you mention .bash_profile. That one is only read for login shells, so either move the alias definitions, or start an (even slower) login shell by supplying the l flag in addition to i.

Related

How to start a bash session from fish [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
On Ubuntu, I have fish installed, and have it set as my default shell using chsh -s /usr/bin/fish.
I would like to open a bash shell. Entering bash creates a new fish session. How can I open bash without ending my login session?
If you're typing bash and ending up in a fish shell it almost certainly means you have put exec fish in your ~/.bashrc script. Which is a commonly used technique to make fish your "default" shell without the risk that chsh -s /usr/bin/fish entails. Just remove that line from your .bashrc now that you no longer need it.

How can I convert my current terminal state (non-tmux) to a new tmux session? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
Often when working on a project I start by opening a single terminal and executing commands normally, and then find that I need another terminal window so I start a tmux session and split into 2, 3, etc panes. However, I'm working with ros and other tools and often need to execute commands like source devel/setup.bash etc to set up env variables and make certain tools available.
Is there an easy way to automatically convert my current terminal state (including up-arrow history, environment variables, everything sourced, etc to a new tmux session? Something like tmux new-session --from-current-state?
I know I can use a config to automatically run commands on a new tmux startup but I'd rather have it flexibly use the current terminal state so that I can use it for multiple projects etc without having to write a new config file for each environment.
Thanks for the suggestions. I guess I'll go with echo "tmux" >> ~/.bashrc...

How to fix my PS1 and after I messed it up [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 3 years ago.
Improve this question
I wanted to customize my terminal and one of the things I did was install zsh and made zsh my default shell (on iterm2).
Now I wanted to customize my ps1. Following online tutorials, I edited my ~/.bash_profile and added the line PS1 = "\h:\W"
Then I ran the command source ~/.bash_profile and now my terminal prompt starts with just "\h:\W". When in reality, I expected it to return "MyName: Current Directory"
I have no idea how to fix this. Editing my PS1 does not help the situation. Not sure why the backslashes haven't been working like in the PS1 guidelines I've found online.
From Customizing your shell prompt - For your user id and the current folder (and zsh)
PS1="%n:%/ "
on my mac that yields the prompt
efrisch:/Users/efrisch
I have no idea how to fix this You can also remove the line you added to your ~/.bash_profile and logout and back-in.

How can I set up short forms for commands on Unix shell? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
If some frequently used commands in Unix shell are given short forms, it reduces programmer's effort.
example :
How can I use e instead of "emacs -nw".
You can create command aliases. Open the ~/.bashrc file and add this line:
alias e='emacs -nw'
Then re-load it to apply changes:
source ~/.bashrc
In your .bashrc in your home directory add
alias e='emacs -nw'
to the end of the file. Either source the .bashrc file or open a new terminal to see the effects.
If you aren't already aware of aliases, skip them and move straight to shell functions:
e () {
emacs -nw "$#"
}

How does Unix/shell scripting work? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I was just curious about the logic of a Unix environment. I'm under the impression that Unix is an operating system, but also a shell. As a subset there are more specific shells such as Bourne, Bash, and Korn shells. And these shells are interpreters and have their own functions to interpret scripts, and also have functions such as ping, pwd, etc? So there are shells within shells? Is everything I said correct?
The Unix operating system is not a shell.
A shell is just a program that makes it easy to interact with your computer by running programs and manipulating data streams.
The 'functions' you mentioned are programs, and not part of the shell.
You can run a shell from another shell if you want. For example, you are in a bash session and you want to switch to csh for something. You run csh and when you're finished, you exit to return to the bash shell.
If you like, you can run another copy of bash inside a bash session. You might do this if you want to modify some environment variables and then undo your changes when you return.
In all these cases, all you did was run a program from a shell and waited for it to terminate. If that program also happened to be a shell, it's nothing special.

Resources