Posts

Showing posts with the label vim

How to setup NeoVim configuration file

Image
NeoVim is a super flexible and configurable editor. However, setting up its configuration file can a bit confusing for the beginners Neovim, born as a modern fork of the venerable Vim text editor, has emerged as a powerful tool that revolutionizes the text editing experience for developers and power users alike. With its commitment to compatibility, extensibility, and performance, Neovim has won the hearts of a growing community of enthusiasts. Neovim retains all the beloved features of Vim while introducing significant enhancements and new capabilities. A text editor with a command-line interface, offers several advantages over a graphical Integrated Development Environment (IDE): Firstly, Neovim embraces simplicity , stripping away unnecessary visual clutter and providing a clean and distraction-free environment. This minimalistic approach allows programmers to focus solely on their code, promoting a more immersive and efficient coding experience. Secondly, Neovim boasts remarka...

How to use the visual mode in vim

Image
The Vim editor provides a powerful feature known as visual mode, which allows users to select and manipulate text in a more interactive and precise manner. In visual mode, users can easily highlight text by moving the cursor or using motion commands. This mode offers three variations: character-wise, line-wise, and block-wise visual modes. Character-wise visual mode selects text character by character, line-wise visual mode selects whole lines, and block-wise visual mode selects rectangular blocks of text. Once text is selected, various operations can be performed, such as copying, cutting, pasting, or applying commands to the selected text. Vim's visual mode offers a flexible and efficient way to manipulate and edit text, making it a valuable tool for users seeking fine-grained control over their editing tasks. Visual Line Mode The visual line mode is a versatile feature that allows users to select and manipulate entire lines of text in a convenient and efficient manner. By e...

How to use vim as your IDE

Image
Vim can be transformed into a powerful Integrated Development Environment (IDE) through the use of plugins and custom configurations. In this article we are going to use the latter to allow you to compile a project from vim Once you are able to compile your code without having to leave the vim window, you can say that vim is your IDE. However, in order to do so, you will need to use a powerful vim feature called the Location List. It is a small window that pops up at the bottom of the current window, and we are going to use it for displaying the compilation result. If there are compilation errors, we will be able to navigate directly to them from the Location List window. First, we need to setup the command that we are going to use for compiling the source code. For example, we can use nmake to compile a project in Windows: set makeprg=nmake Vim comes with some predefined patterns for the error formats of the compilers, so that vim can parse them and navigate from the err...

How to use windows, tabs and buffers in vim

Image
In Vim, buffers, windows, and tabs are essential concepts that help users efficiently manage and navigate multiple files and views within the editor Together, buffers, windows, and tabs in Vim offer a powerful and flexible environment for editing and navigating files. Users can switch between buffers, resize and rearrange windows, and create new tabs to suit their workflow. These features enable efficient multitasking and enhance productivity when working with multiple files or different sections of code. Buffers represent the opened files or text contents in Vim. Each file being edited is stored in a separate buffer, which allows users to switch between different files quickly. Buffers can be created, modified, saved, and closed, providing flexibility and control over the editing process. Windows , on the other hand, refer to the split views within the Vim editor. Users can split the Vim window horizontally or vertically, creating multiple windows to display different buffers si...

How to use vim horizonal movements

Image
Horizontal movements in Vim refer to the navigation and movement commands that allow users to traverse the text horizontally within the editor As stated in the article  [vim - Vertical movements]  the best way to learn how to use vim horizontal movements is to disable the arrows and pageUp/pageDown keys. Vim provides a range of commands for moving the cursor left or right by characters, words, or specific positions within a line. They provide users with precise control over their cursor position, allowing for efficient navigation, editing, and manipulation of text within the editor. The horizontal movements can be divided into several categories depending on the level of movement that you are going to perform: Words : each sequence of characters up to a special character is considered a word Blocks of text : each sequence of characters up to a white space is considered a block Occurrence : find an occurrence of a specific character from the cursor position Character : mov...

How to use vim vertical movements

Image
Vertical movements in Vim refer to the commands and techniques used to navigate and move the cursor up and down within the editor Vim offers various commands to facilitate vertical movement, allowing users to efficiently traverse through lines, paragraphs, and larger blocks of text. They enable users to swiftly navigate through their code or text, making it easier to locate specific sections, review content, or perform targeted editing tasks. The best way to learn how to use the vim movements is to disable the arrows and PageUp/PageDown keys. That way, you will force yourself to use the vim key combinations to move around. These are the instructions that you can add to your .vimrc to disable those keys: " DISABLE Arrows keys and PageUp/PageDown noremap <Up> <Nop> noremap <Down> <Nop> noremap <Left> <Nop> noremap <Right> <Nop> noremap <PageUp> <Nop> noremap <PageDown> <Nop> Apart ...