AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / computer / 问题

问题[vim](computer)

Martin Hope
Gabor Garami
Asked: 2024-01-14 04:45:19 +0800 CST

VIM 使用错误的编码 - 但仅在状态消息中

  • 6

我的 ArchLinux 设置遇到了一个奇怪的问题。Vim 使用正确的编码来读取/显示文件,但这些状态消息(显示当前模式或在缓冲区写入文件时报告)对(匈牙利语)消息使用错误的编码。

我尝试设置 termencoding=utf-8 但它不能解决问题。编码正确设置为utf-8。MATE 终端也是 UTF-8 格式,我的语言环境也是 UTF-8 格式:

LANG=hu_HU.UTF-8
LC_CTYPE="hu_HU.UTF-8"
LC_NUMERIC="hu_HU.UTF-8"
LC_TIME="hu_HU.UTF-8"
LC_COLLATE="hu_HU.UTF-8"
LC_MONETARY="hu_HU.UTF-8"
LC_MESSAGES="hu_HU.UTF-8"
LC_PAPER="hu_HU.UTF-8"
LC_NAME="hu_HU.UTF-8"
LC_ADDRESS="hu_HU.UTF-8"
LC_TELEPHONE="hu_HU.UTF-8"
LC_MEASUREMENT="hu_HU.UTF-8"
LC_IDENTIFICATION="hu_HU.UTF-8"

我目前没有想法,请帮助我。

在此输入图像描述

vim
  • 1 个回答
  • 52 Views
Martin Hope
Jessica Sanford
Asked: 2023-08-26 04:21:03 +0800 CST

iTerm 2 ZSH 字体全一种颜色

  • 6

与 iTerm 2 ZSH 相关的 颜色/主题未正确显示

机器:macOS Ventura 13.3

我的 iTerm2 不会使用除全白色(以及 vim 中的全黑色)之外的任何其他颜色作为我的字体。谁能看到我做错了什么吗?

下面链接的图片显示了结果

print -P '%F{yellow}yellow %F{2}green %1Fred %F{117}light blue'

和我的 iTerm2 配置文件颜色设置:

印刷错误的字体颜色

另外,我的 iTerm2 配置文件终端设置的照片:

终端设置

这是我的.zshrc:

# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
 
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
 
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="afowlermod"
 
# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
# a theme from this variable instead of looking in $ZSH/themes/
# If set to an empty array, this variable will have no effect.
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
 
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
 
# Uncomment the following line to use hyphen-insensitive completion.
# Case-sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"
 
# Uncomment one of the following lines to change the auto-update behavior
# zstyle ':omz:update' mode disabled  # disable automatic updates
# zstyle ':omz:update' mode auto      # update automatically without asking
# zstyle ':omz:update' mode reminder  # just remind me to update when it's time
 
# Uncomment the following line to change how often to auto-update (in days).
# zstyle ':omz:update' frequency 13
 
# Uncomment the following line if pasting URLs and other text is messed up.
# DISABLE_MAGIC_FUNCTIONS="true"
 
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
 
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
 
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
 
# Uncomment the following line to display red dots whilst waiting for completion.
# You can also set it to another string to have that shown instead of the default red dots.
# e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f"
# Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765)
# COMPLETION_WAITING_DOTS="true"
 
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
 
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
# HIST_STAMPS="mm/dd/yyyy"
 
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
 
# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git)
 
source $ZSH/oh-my-zsh.sh
 
# User configuration
 
# export MANPATH="/usr/local/man:$MANPATH"
 
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
 
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
#   export EDITOR='vim'
# else
#   export EDITOR='mvim'
# fi
 
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
 
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"

和我的 zsh 主题:

PROMPT='jess %B%F{blue}:: %b%F{green}%3~ $(hg_prompt_info)$(git_prompt_info)%B%(!.%F{red}.%F{blue})»%f%b '
RPS1='%(?..%F{red}%? ↵%f)'

ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹"
ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}"

ZSH_THEME_HG_PROMPT_PREFIX="%{$fg[magenta]%}hg:‹%{$fg[yellow]%}"
ZSH_THEME_HG_PROMPT_SUFFIX="%{$fg[magenta]%}› %{$reset_color%}"
ZSH_THEME_HG_PROMPT_DIRTY=" %{$fg[red]%}✗"
ZSH_THEME_HG_PROMPT_CLEAN=""

我还使用 Pathogen 来设置我的 vim 主题,我的.vimrc看起来像这样:

set ruler
execute pathogen#infect()
set cursorline
syntax on

filetype plugin indent on

syntax enable

set background=light
colorscheme solarized

我的.vim目录:

jess :: ~/.vim » tree
.
├── autoload
│   └── pathogen.vim
└── bundle
    ├── README.mkd
    ├── autoload
    │   └── togglebg.vim
    ├── bitmaps
    │   └── togglebg.png
    ├── colors
    │   └── solarized.vim
    ├── doc
    │   ├── solarized.txt
    │   └── tags
    └── vim-colors-solarized
        ├── README.mkd
        ├── autoload
        │   └── togglebg.vim
        ├── bitmaps
        │   └── togglebg.png
        ├── colors
        │   └── solarized.vim
        └── doc
            ├── solarized.txt
            └── tags

vim
  • 1 个回答
  • 21 Views
Martin Hope
c10
Asked: 2023-08-10 19:09:57 +0800 CST

gnu-screen 下的 vim 无法正确获取左移/右移键盘映射

  • 5

我最近开始使用 gnu-screen。在 vimrc 中,我有如下 2 个键盘映射,以帮助在 vim 拆分窗口之间轻松导航

nmap <S-Left> <C-w><Left>
nmap <S-Right> <C-w><Right>

从普通 shell 运行 vim,上面的导航键映射按预期工作。

从 gnu-screen 会话运行 vim,这些按键映射失败,而是删除这些行!

我尝试过以下方法:

  1. 在 vimrc 中设置 term=xterm
  2. set t_kr=^[[1;2C (我错误地认为 t_kr 将有助于正确给出“右移”)

但未能修复。这里有人可以帮忙吗?

vim
  • 1 个回答
  • 12 Views
Martin Hope
h33925
Asked: 2023-06-25 15:12:19 +0800 CST

NeoVim:根据 git 分支在打开的选项卡组之间切换

  • 5

当在 git 存储库中处理多个不同的分支时,我发现自己想要在不同的选项卡中打开不同的文件集。是否有任何插件或方法可以在签出不同分支时本质上“保存”打开选项卡的当前状态,并且当再次签出原始分支时 - 该组选项卡将被恢复?理想情况下能够保持几个不同分支的选项卡状态。

运行 NeoVim 的多个实例并通过挂起进程来管理它,以某种方式让他们不会因打开相同的文件而感到不安,可能是一种选择。

vim
  • 1 个回答
  • 57 Views
Martin Hope
Marc P
Asked: 2023-05-21 06:02:32 +0800 CST

将同一行上的文件名复制到行尾

  • 5

我在 VIM 中有以下几行:

<img src="file01.jpg" / >
<img src="file02.jpg" / >
<img src="file03.jpg" / >

我想将每个 jpg 的文件名添加到每一行的末尾,如下所示:

<img src="file01.jpg" / > file01.jpg
<img src="file02.jpg" / > file02.jpg
<img src="file03.jpg" / > file03.jpg

实现这一目标的最佳方法是什么?

vim
  • 1 个回答
  • 28 Views
Martin Hope
Stephane
Asked: 2023-03-04 01:49:31 +0800 CST

在找到和突出显示的模式上找不到模式消息

  • 6

我有相当多的 PHP 类源文件,我可以使用命令列出这些grep -r "class " *文件,每个文件都包含class <MyClass>模式。

例如,一个这样的文件包含:

<?php

class NavlinkItem {

  var $id;
  var $name;
  var $description;
  var $image;
  var $imageOver;
  var $url;
  var $blankTarget;
  var $language;
  var $templateModelId;
  var $navlinkId;

  function NavlinkItem($id = '') {
  }

我想function NavlinkItem用图案替换图案function __construct。

该NavlinkItem模式可以从system/navlink/NavlinkItem.php源文件的实际名称派生,我可以得到它expand('%:t:r')

我可以将NavlinkItem模式存储在a寄存器中let @a = expand('%:t:r')

我想对该寄存器的内容进行替换execute 's/function ' . getreg('a') . '/function __construct/'

该模式似乎已找到,因为它以黄色突出显示。

但该命令仍然出错并显示E486: Pattern not found: function NavlinkItem消息。

vim
  • 1 个回答
  • 23 Views
Martin Hope
gman
Asked: 2022-09-23 23:24:21 +0800 CST

使用 vim 命令模式生成的名称保存文件

  • 6

我正在尝试使用从 vim 命令模式生成的名称保存文件。我正在使用命令:

:w !tee"/tmp/vim/$(date +'%s').tmp"

但它给我一个错误,文件名不能为空。我在这里错过了什么吗?

vim
  • 1 个回答
  • 13 Views
Martin Hope
flawr
Asked: 2022-09-17 03:56:37 +0800 CST

如何通过 tmux 管理 vim 剪贴板?

  • 5

我注意到当通过终端使用 VIM 时,我可以使用剪贴板寄存器轻松地将一行文本复制到我的系统剪贴板V"+y(也就是说,然后使用Shift+Insertor将该文本粘贴到我的终端以外的其他窗口Ctrl+v。)

现在我注意到如果我在 tmux 会话中运行 VIM,那将不再起作用。我知道有一个 tmux 剪贴板,但我从来没有真正使用过它。有没有办法让那个被拉出的文本仍然进入我的系统剪贴板?

ubuntu vim
  • 1 个回答
  • 36 Views
Martin Hope
Lunartist
Asked: 2022-08-24 22:53:29 +0800 CST

如何使用远程终端工具在 vim/Linux 中输入 ASCII ESC

  • 5

ENV = Centos7,bash 版本 4.2.46


主要目标-
我希望 ANSI 颜色代码在使用cator时显示颜色而不是实际代码tail。


当前状态-

如果sample.txt包含如下代码

\e[32m green \e[0m

cat sample.txt将导致显示实际代码而不是其颜色。
在此处输入图像描述


我的尝试——

我试过 用 vi 编辑器打开时echo -e "\e[32m green \e[0m" >> sample.txt
转换成的。 当我显示颜色时^[[32m green ^[[0msample.txt
cat sample.txt
在此处输入图像描述


问题-
我如何才能^[在 vim 或控制台中实际输入字符?
我在stackoverflow中发现有人说我可以打字CTRL + [,但它不起作用。
我认为它只适用于纯 Linux 环境?但我只能从窗口使用 ssh 远程工具。

*编辑如何使用 VSCode 输入它?当我下载脚本并打开它时,它会显示红色的 ESC 框。
在此处输入图像描述

linux vim
  • 1 个回答
  • 22 Views
Martin Hope
Jonathan Strange
Asked: 2022-08-14 08:49:43 +0800 CST

如何永久重新映射 petadactyl 键

  • 5

使用 firefox 的 pentadactyl 扩展,我怎样才能持续更改键映射。例如,下次打开浏览器时如何更改 shift+j 以转到下一个选项卡?命令 map J gt 按预期工作,但在关闭浏览器窗口时恢复为默认值。如何使软件记住更改?

firefox vim
  • 1 个回答
  • 13 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何减少“vmmem”进程的消耗?

    • 11 个回答
  • Marko Smith

    从 Microsoft Stream 下载视频

    • 4 个回答
  • Marko Smith

    Google Chrome DevTools 无法解析 SourceMap:chrome-extension

    • 6 个回答
  • Marko Smith

    Windows 照片查看器因为内存不足而无法运行?

    • 5 个回答
  • Marko Smith

    支持结束后如何激活 WindowsXP?

    • 6 个回答
  • Marko Smith

    远程桌面间歇性冻结

    • 7 个回答
  • Marko Smith

    子网掩码 /32 是什么意思?

    • 6 个回答
  • Marko Smith

    鼠标指针在 Windows 中按下的箭头键上移动?

    • 1 个回答
  • Marko Smith

    VirtualBox 无法以 VERR_NEM_VM_CREATE_FAILED 启动

    • 8 个回答
  • Marko Smith

    应用程序不会出现在 MacBook 的摄像头和麦克风隐私设置中

    • 5 个回答
  • Martin Hope
    Vickel Firefox 不再允许粘贴到 WhatsApp 网页中? 2023-08-18 05:04:35 +0800 CST
  • Martin Hope
    Saaru Lindestøkke 为什么使用 Python 的 tar 库时 tar.xz 文件比 macOS tar 小 15 倍? 2021-03-14 09:37:48 +0800 CST
  • Martin Hope
    CiaranWelsh 如何减少“vmmem”进程的消耗? 2020-06-10 02:06:58 +0800 CST
  • Martin Hope
    Jim Windows 10 搜索未加载,显示空白窗口 2020-02-06 03:28:26 +0800 CST
  • Martin Hope
    andre_ss6 远程桌面间歇性冻结 2019-09-11 12:56:40 +0800 CST
  • Martin Hope
    Riley Carney 为什么在 URL 后面加一个点会删除登录信息? 2019-08-06 10:59:24 +0800 CST
  • Martin Hope
    zdimension 鼠标指针在 Windows 中按下的箭头键上移动? 2019-08-04 06:39:57 +0800 CST
  • Martin Hope
    jonsca 我所有的 Firefox 附加组件突然被禁用了,我该如何重新启用它们? 2019-05-04 17:58:52 +0800 CST
  • Martin Hope
    MCK 是否可以使用文本创建二维码? 2019-04-02 06:32:14 +0800 CST
  • Martin Hope
    SoniEx2 更改 git init 默认分支名称 2019-04-01 06:16:56 +0800 CST

热门标签

windows-10 linux windows microsoft-excel networking ubuntu worksheet-function bash command-line hard-drive

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve