首页 > 其他分享 >vim 替换

vim 替换

时间:2023-02-28 13:55:38浏览次数:29  
标签:redis 替换 conf net vim data networks

命令:substitude

:s/{from}/{to}

其中 ssubstitude

  • :s/{from}/{to} 当前行的第一个 from 替换为 to
  • :s/{from}/{to}/g 将当前行中的 from 替换为 to
  • :s/{from}/{to}/gc 将当前行中的 from 替换为 to,并在执行前进行确认询问
  • :%s/{from}/{to}/g 将所有行中的 from 替换为 to
version: '3'

services:
  example-redis:
    image: redis:5.0.5
    container_name: example-redis
    restart: always
    ports:
      - 63791:6379
    volumes:
      - ./data:/data
      - ./conf/redis.conf:/etc/redis/redis.conf
    networks:
      - redis-net
networks:
  redis-net:

将上面的 example-redis 替换为 redis

:%s/example-redis/redis/g

version: '3'

services:
  redis:
    image: redis:5.0.5
    container_name: redis
    restart: always
    ports:
      - 63791:6379
    volumes:
      - ./data:/data
      - ./conf/redis.conf:/etc/redis/redis.conf
    networks:
      - redis-net
networks:
  redis-net:

标签:redis,替换,conf,net,vim,data,networks
From: https://www.cnblogs.com/yangzhenlong/p/17163960.html

相关文章

  • vim 快捷键
    有时候不太记得vim快捷键。记录一下。操作键位删除/剪切一行dd删除/剪切当前开始的n行ndd删除/剪切光标之后的一个字/单词部分dw删除/剪切光标之......
  • C# 文本文件的查找及替换(WinForm)
    usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.IO;usingSystem.Linq;using......
  • sed命令的使用(替换)
    sed命令使用场景当你经历下面场景的时候你应该学会使用现在有多个文件,要对文件中同样的内容进行替换,要替换称相同的内容。一个一个打开文件从而进行修改,这个方法可以但......
  • 4.10-替换算法
    需要替换算法的原因程序运行一段时间后,Cache存储空间被占满,当再有新的数据要调入时,就需要通过某种机制决定替换的对象集中常见的替换算法先进先出-FIFO最不经常使用......
  • 【ASP.NET Core】标记帮助器——替换元素名称
    标记帮助器不仅可以给目标元素(标记)插入(或修改)属性,插入自定义的HTML内容,在某些需求中还可以替换原来标记的名称。比如我们在使用Blazor时很熟悉的Component标记帮助器......
  • Linux极简入门系列(三):vim文本编辑器
    vim是Linux的文本编辑器,当我们在Linux系统中创建或编辑配置文件、Dockerfile、ymal等文件时,都会使用到它。  一、最基本使用:1、创建abc.txt文件-输入内容hellowor......
  • vim中的命令行 %! 是啥意思?
    :%!commandpipesthecurrentfile'scontentsto command'sstdin,andreplacesthefile'scontentswith command'sstdout.So, :%!sort isprettymuchthe......
  • Linux vim
    编辑器之神-vimvi简介vi是“Visualinterface”的简称,它在Linux上的地位就仿佛Edit程序在DOS上一样。它可以执行输出、删除、查找、替换、块操作等众多文本操作,而且......
  • VS打开工程时提示:文件加载 使用Unicode (UTF-8)编码加载文件***时,有些字节已用Unicode
    原文地址:https://blog.csdn.net/hellokandy/article/details/125791844折腾了大半天,原本好好的工程,在重启电脑后,再用VS打开时竟然提示:文件加载,使用Unicode(UTF-8)编码加......
  • ubuntu20.04 用vim+ctags+cscope搭建符合sourceinsight习惯的IDE
    1.安装vimsudoaptinstallvim按自己习惯配置vim~/.vimrcsetnocompatiblesetnufiletypeonsethistory=1000setbackground=darksyntaxonsetautoindentse......