这是一个奇怪的问题,我无法与谷歌找到一个好的答案(当然,我总是有可能失败).在我的bash提示符下,如果我为提示的一部分着色,当我点击'up'转到上一个命令时,我不能在超过一定数量的字符(特别是31)之后转到该行的开头.
我当前的bash提示是:(颜色在我的.bashrc中定义)
PS1="[\u@$cyan\h$NC \w] "
Run Code Online (Sandbox Code Playgroud)
但如果我把它改成这个:
PS1="[\u@\h \w] "
Run Code Online (Sandbox Code Playgroud)
它不再阻止我走到行的开头.
奇怪的部分,在视觉上,当我回到家中去到行的开头(或使用箭头键)时它会将11个字符停在字符串中,但是如果我从那里编辑它,它会从头开始编辑这条线.
有谁知道为什么会发生这种情况?我希望在我的提示中使用颜色,因为我进行服务器管理,颜色是我如何区分我的盒子一目了然.
我环顾四周但没有找到答案.我有一台运行与我的CentOS 5.8服务器相同的.vimrc的CentOS 6.2服务器,但是当我在我的6.2服务器上输入VIM时,它会添加上一行的第一个字符,如果它是某个字符(%或#是我见过的那些).这就是VIM中发生的事情(点击输入后的秒线,但没有输入任何其他内容):
# <enter>
#
% <enter>
%
Run Code Online (Sandbox Code Playgroud)
这是我的.vimrc:
set autoindent
set smartindent
set tabstop=4
set shiftwidth=4
set showmatch
set number
imap jj <Esc> " Professor VIM says '87% of users prefer jj over esc', jj abrams disagrees
" Indenting *******************************************************************
set ai " Automatically set the indent of a new line (local to buffer)
set si " smartindent (local to buffer)
" Cursor highlights ***********************************************************
"set cursorline
"set cursorcolumn
" Set an orange cursor in insert mode, and …Run Code Online (Sandbox Code Playgroud) 当我运行我的代码时,我在编译时遇到此错误:
# g++ -std=c++0x sixteen.cpp -O3 -Wall -g3 -o sixteen
sixteen.cpp: In function ‘int main()’:
sixteen.cpp:10: error: call of overloaded ‘stoi(char&)’ is ambiguous
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/basic_string.h:2565: note: candidates are: int std::stoi(const std::string&, size_t*, int) <near match>
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/basic_string.h:2626: note: int std::stoi(const std::wstring&, size_t*, int) <near match>
Run Code Online (Sandbox Code Playgroud)
我查看了该错误,并按照此处其他问题的说明进行了操作,但删除后仍然出现错误using namespace std;.为什么这仍然发生,我该怎么做才能摆脱它?
码:
#include <iostream>
#include <string>
int main() {
std::string test = "Hello, world!";
std::string one = "123";
std::cout << "The 3rd index of the string is: " << test[3] << std::endl;
int …Run Code Online (Sandbox Code Playgroud)