Posts in category “Tips”

How to use vim macro to speed up your complex find/replace operations in vim / ideavim

Yesterday, I need to replace a string ClassName with List<ClassName> many times in a few files, and the ClassName varies. Manually doing it again and again is tedious and mistake prone, which is what I hate. Here's the solution

First, record a macro,

  1. move cursor on any letter of the target ClassName
  2. qa
  3. ysiw>
  4. Insert
  5. List
  6. Esc
  7. q

Second, replay the macro, move cursor to another occurrence of ClassName,

@a

Third, replay the same macro as many times as you want: move cursor to any other occurrences, simply type

@@

The feeling is so good to let a computer do what you want it to do!

and here's the Reference where I learnt how to use vim macro. TL;DR;

Multiline matches with ripgrep (rg)

You can simply click the title of this blog to check the reference.

The key is the dotall modifier (?s). It helped out me today! by the way, my final match expression is

rg --pcre2 -U '(?s)\.Initialise\([^,]+,\s*([^,]+),\s*\1(?:,true|false)?\);'

rg is a so fast and so powerful tool in my daily use, I love it!

Reference

[Solution]Microsoft.AspNetCore.Http was marked deprecated

Remove those deprecated NuGet packages, use the ASP.NET Core shared framework instead

With the release of .NET Core 3.0, many ASP.NET Core assemblies are no longer published to NuGet as packages. Instead, the assemblies are included in the Microsoft.AspNetCore.App shared framework, which is installed with the .NET Core SDK and runtime installers. For a list of packages no longer being published, see Remove obsolete package references.

As of .NET Core 3.0, projects using the Microsoft.NET.Sdk.Web MSBuild SDK implicitly reference the shared framework. Projects using the Microsoft.NET.Sdk or Microsoft.NET.Sdk.Razor SDK must reference ASP.NET Core to use ASP.NET Core APIs in the shared framework.

To reference ASP.NET Core, add the following element to your project file:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <FrameworkReference Include="Microsoft.AspNetCore.App" />
  </ItemGroup>

</Project>

Reference

How to remote desktop fullscreen RDP with just SOME of your multiple monitors

solution

Basically, you need to change or add the following options. The first three lines you can simply copy, but the fourth line, you should change to your own values.

screen mode id:i:2
use multimon:i:1
span monitors:i:1
selectedmonitors:s:3,4

explanation:

  • screen mode id:i:2 -- i means integer: 2 means fullscreen mode

  • use multimon:i:1 -- the remote desktop session will use multiple montiors

  • span monitors:i:1 -- allow to use part of the monitors for remote desktop session

  • selectedmonitors:s:3,4 -- specify what monitors you want to use: the value 3,4 could be different from yours. run mstsc /l (l here is L in lowercase) to check your own monitor ids.

Reference

[GitHub] Viewing all of your issues and pull requests