Skip to content

trunghn295/trunks_nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Useful Neovim Tips

Window and Font Management

  • Shift + Arrow Keys: Resize windows.
  • Ctrl + - / Ctrl + +: Decrease/Increase font size.

Opening Files in Neovim

  • nvim +<line_number> <file>: Open file and jump to the specified line.
  • nvim +/<pattern> <file>: Open file and search for the pattern.
  • nvim -d <file1> <file2>: Open two files and show their diff.
  • nvim -c "normal <command>" <file>: Open file and execute a normal mode command.
  • nvim $(find <dir> -iname <pattern>): Open files found by the find command.
  • <command> | nvim -: Open output of a shell command in Neovim.

Handy Editing Tips

  • Create a numbered column: Ctrl+Q (block select with j/k), then g Ctrl+A.
  • Exit terminal mode: Ctrl+\ Ctrl+N.
  • Delete all buffers: :%bd.
  • Save session to Session.vim: :mks!. Open with: nvim -S Session.vim.
  • Run macro on multiple lines: Start recording with qa, stop with q, block select lines with Ctrl+Q and j/k, then :norm! @a.
  • Search and replace in all buffers: :bufdo %s/<pattern>/<replace>/ge | update.
  • Search and run normal command: :%g/<pattern>/norm <command>, e.g., :%g/foo/norm d3j.
  • Search and replace in all files: :Rg <pattern>, select all with Alt+A, then :cfdo %s/<pattern>/<replace>/gc | update.
  • Delete lines not matching a pattern:
    • :g!/<pattern>/d
    • or :v/\v(<pattern>)/d
  • Set bookmark 'a': ma — Jump to bookmark 'a': `a
  • Correct typo/grammar: z=
  • Output result of a Vim command to a file: :redir @a, run command, :redir END, then open file and type "ap.

About

This is just a small configuration for my daily use neovim

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages