Buffers and Windowsλ︎
Buffers hold the contents of files and any other information from processes, e.g. the REPL evaluation log
Windows are a container for a buffer and windows can swap which buffer they show. Multiple windows, also known as splits, can be present in a Neovim frame. By default, neovim starts with only one window.
A tab can hold one or more windows and tabs can be shown on a tab-line.
File explorerλ︎
Visually manage files with a tree view of the current project, using Neo-tree.nvim
SPC e
toggles neo-tree file browser
SPC o
toggles between buffer and neo-tree
Neotree icons
- yellow dot - unsaved changes
- pencil - git added changes
- cross - git deleted changes
- Warning triangle - lsp diagnostics issues
SPC f t t
to open file explorer
New Fileλ︎
Files and directories are created in the path given, relative to the directory in which Neovim was opened.
:lcd
to set the current local directory
:!
for a shell command, e.g.:!mkdir -p path/to/new/directory
create a new directory and any intermediate path
SPC w
will write all buffer changes to the associate file.
SPC n
creates a new buffer that can be written to a given file using :write path/to/filename
:write path/to/filename
will write the current buffer to a new file.
SPC f b ESC C
to create a new file or directory. The base path is shown in the command bar. Type the name of directories and file name as required. RTN
to create or ESC
to cancel. The newly created directories or file name appears n the Telescope list and scan be selected for opening.
Telescope Normal mode and help
ESC
in Telescope to switch to Normal mode and use comannds, c
for Create, r
to rename.
?
to show all the commands available in Telescope
:write path/to/filename
will write the current buffer to a new file
:!mkdir path/to/directory
will create a new directory
Select files and directoriesλ︎
Telescope provides a selector which will narrow the list of matches as a pattern is typed, providing a fast way to find an item in a list.
Telescope provides a preview of the selected file (only if there is sufficient space in the Neovim frame)
File lists are relative to the directory Neovim was opened from (or Path subsequently set in Neovim).
SPC f f
selector for files within the scope of the current directory path. SPC f F
to also show hidden files from the current directory path.
SPC f a
selector for AstroNvim user configuration files
SPC f p
selector for previously opened files (oldfiles)
SPC f f
to list files within the scope of the current directory path.
SPC f b
provides a file browser to open files, navigate the file space and create new files and directories
Buffer managementλ︎
SPC f b
selector for currently open buffers
SPC b b
to select a buffer from the tab line, pressing the character that appears next to the buffer tab (case sensitive)
SPC b D
to delete a buffer from the tab line, pressing the character that appears next to the buffer tab (case sensitive)
Open multiple buffers when starting Neovim by specifying multiple files to open
SPC b b
switch between buffers in the current window, using a Telescope popup that lists all current buffers (includes files, Conjure REPL Log, etc.).
SPC b n
(:next
) and SPC b n
(:previous
) to cycle through buffers in the current window
SPC TAB
(C-^
) opens the previous buffer, useful to toggle between two buffers in the same window
Use Telescope to switch between buffers
Open multiple buffers when starting Neovim by specifying multiple files to open
Buffer text wrappingλ︎
The test in a buffer is not wrapped by default. Set and unset soft text wrapping in a buffer
Window managementλ︎
Windows can be active (contains the cursor), hidden (open but not shown) or inactive.
\
creates an horizontal split
SPC q
removes the current split
SPC h
/ SPC l
to jump to left / right buffer, SPC j
/ SPC k
to jump to buffer below / above
SPC b b
to list current buffers and switch between them using telescope
C-w
and hjkl
to navigate windows is the classic Vim approach
C-w
menu to manage Windows, also known as splits.
C-w
with one of hjkl
will move the cursor to the next window in that direction. Also works with arrow keys.
C-w w
toggle between open windows
:q
or C-w q
closes the active window, closing Neovim if it is the last active window.
:wincmd
can be used as an alternative to the Normal mode key bindings
Open file in a new window
Resize windows
C-w
-
, +
, <
or >
for vertical or horizontal size adjustment