syntax enable<\/code><\/pre>\n\n\n\nBy default, vim automatically wraps long lines. This is a sane default. But if you want to display long lines as just one line, use the following:<\/p>\n\n\n\n
set nowrap<\/code><\/pre>\n\n\n\nNow, you will need to press the right arrow key or l<\/code> key a lot to read any line.<\/p>\n\n\n\nOr, you can enable no-wrapping only for specific files. I will talk about that later.<\/p>\n\n\n\n
First, know what is soft and hard wrapping:<\/p>\n\n\n\n
Soft wrapping<\/strong>: You already know it. It is the wrapping I talked about in the above lines. When your text editor is unable to show you the full line, it wraps the line. But the text editor does not enter a newline character in your file.<\/p>\n\n\n\nHard wrapping<\/strong>: Here, your text editor enters a newline character<\/strong> in your file. You can enable this if you want to force yourself to always code in small lines.<\/p>\n\n\n\nTo enable hard wrapping use the option textwidth<\/code> as given below<\/p>\n\n\n\nset textwidth=80<\/code><\/pre>\n\n\n\nNow, Nvim will press Enter after you have typed 80 characters in your file. By default, it is off. Set it to 0 for turning it off (in case some nasty plug-in is turning it on).<\/p>\n\n\n\n
How to make neovim move up\/down while pressing h\/l at the start\/end of the line<\/h2>\n\n\n\n By default, when you are at the beginning or end of a line in nvim and press the key h<\/code> or l<\/code>, the cursor will not go to the previous or next line respectively. To make it go previous or next line, use the option, whichwrap<\/code>:<\/p>\n\n\n\nset whichwrap+=<,>,h,l<\/code><\/pre>\n\n\n\nNow, pressing h or l at the beginning or end will move the cursor to the previous or next line respectively.<\/p>\n\n\n\n
How to show cursor position in Neovim<\/h2>\n\n\n\n To show the cursor position all the time, set the ruler<\/code> option on. Now, the position of the cursor i.e. line number and column number at which this cursor is located will be shown at the bottom right corner.<\/p>\n\n\n\nset ruler<\/code><\/pre>\n\n\n\nfig: ruler in neovim showing cursor’s line and column number<\/figcaption><\/figure>\n\n\n\nYour Neovim might show it a little differently because I have set a plugin to make it look fancier.<\/p>\n\n\n\n
To set command height use the variable cmdheight<\/code>. It is used to show the command prompt i.e. the line when you hit colon :<\/code> in vim\/neovim. <\/p>\n\n\n\nBy default, it is 1. Make it 0, if you want more screen space. If you have lots of screens (like a big screen monitor), then increase it<\/strong>. If it is 0, it will only appear when you hit the colon button.<\/p>\n\n\n\nset cmdheight=1<\/code><\/pre>\n\n\n\nfig: set cmdheight<\/code> to set the height of the command line in neovim\/vim<\/figcaption><\/figure>\n\n\n\nHow to enable mouse support in Neovim<\/h2>\n\n\n\n To enable your mouse, set the mouse<\/code> variable to i<\/code> for insert mode only, a<\/code> for all modes (insert, normal, and all others). <\/p>\n\n\n\n\ud83d\udcd3 Recommendation<\/strong>: Turn it on because it will enable new features<\/strong> and at the same time, you can disable it temporarily using the shift button. For example, shift+click, drag and drop, etc. will not be transferred to nvim; instead, they will be transferred to your backend i.e. the terminal.<\/p>\n\n\n\nset mouse=a<\/code><\/pre>\n\n\n\nTo make the popup menu bigger\/smaller, use the variable pumheight<\/code>. Please note that a popup menu appears when you right click on Neovim.<\/p>\n\n\n\nset pumheight=10<\/code><\/pre>\n\n\n\nfig: popup menu appears when you right-click in neovim<\/figcaption><\/figure>\n\n\n\nSet it to 0 if you want your whole screen to be taken over when there is a popup menu. Ignore it if you want the default setting.<\/p>\n\n\n\n
Treat dash-separated words as a word text object<\/h2>\n\n\n\n Use the following command to treat dash-separated words as a word text object:<\/p>\n\n\n\n
set iskeyword+=-<\/code><\/pre>\n\n\n\nWhen you set the option splitbelow<\/code>, Horizontal splits will automatically be below.<\/p>\n\n\n\nset splitbelow<\/code><\/pre>\n\n\n\nfig: splits in neovim\/vim<\/figcaption><\/figure>\n\n\n\nSimilarly, to set the option splitright<\/code>, use:<\/p>\n\n\n\nset splitright<\/code><\/pre>\n\n\n\nThese features splitright<\/code> and splitbelow<\/code> also looks more natural, especially for people who write from left to right and top to bottom (for example in English)<\/p>\n\n\n\nNow, Vertical splits will automatically be to the right.<\/p>\n\n\n\n
Using Tab as 2 Spaces in Neovim<\/h2>\n\n\n\n If you use 2 spaces for a tab, you need to configure neovim for this.<\/p>\n\n\n\n
set expandtab\nset shiftwidth=2\nset softtabstop=2\nset tabstop=2<\/code><\/pre>\n\n\n\nThis is useful if you use a lot of tabs in code and your monitor’s screen size is very small<\/strong>.<\/p>\n\n\n\nSet smart indentation in Neovim<\/h2>\n\n\n\n Smart Indentation puts indentation automatically at appropriate places after you type {<\/code>, }<\/code>, or #<\/code>. Now, you don’t need to type tabs after these characters. To turn it on, use the following configuration:<\/p>\n\n\n\nset smartindent\nset autoindent<\/code><\/pre>\n\n\n\nDisplaying status line in Neovim<\/h2>\n\n\n\n The status line is the bottom bar you see above the command line.<\/p>\n\n\n\nfig: statusline in vim and neovim<\/figcaption><\/figure>\n\n\n\nTo display it all the time, set the option laststatus<\/code> to 2.<\/p>\n\n\n\nset laststatus=2<\/code><\/pre>\n\n\n\nSet it to 0<\/code> if you don’t want to see it at all, to 1<\/code> to display the statusline only when there are at least 2 windows.<\/p>\n\n\n\n\ud83d\udcd3 Recommendation<\/strong>: Set the laststatus<\/code> to 2<\/code> if you want to see all information<\/strong> related to your files and Neovim.<\/p>\n\n\n\nHow to display the line numbers in the left column in Neovim<\/h2>\n\n\n\n To display the line number in the left column:<\/p>\n\n\n\n
set number<\/code><\/pre>\n\n\n\nTo make it disappear, which is the default, use the following:<\/p>\n\n\n\n
set nonumber<\/code><\/pre>\n\n\n\nHowever, I use the option relativenumber<\/code>. I find it more useful to execute the commands like 3j<\/code> in the normal mode.<\/p>\n\n\n\nset relativenumber<\/code><\/pre>\n\n\n\nfig: line number in neovim\/vim<\/figcaption><\/figure>\n\n\n\nHow to increase or decrease the size of the number column in Neovim<\/h2>\n\n\n\n You turned on the number column using the above option relativenumber<\/code> or number<\/code> but you might find the width of the column to be very high. This is bad if you have a small screen monitor (like a 14-inch laptop).<\/p>\n\n\n\nTo bring it down, use another option numberwidth<\/code>. I find the value 3<\/code> to be the smallest and best.<\/p>\n\n\n\nset numberwidth=3<\/code><\/pre>\n\n\n\nHow to enable highlighting of the current line<\/h2>\n\n\n\n To enable the line of your cursor, use the option cursorline<\/code>:<\/p>\n\n\n\nset cursorline<\/code><\/pre>\n\n\n\nfig: cursor line in vim\/neovim<\/figcaption><\/figure>\n\n\n\nThis feature is useful while editing a large file<\/strong> because you might lose the position of your tiny cursor – find that is difficult.<\/p>\n\n\n\nHow to show tabline in Neovim<\/h2>\n\n\n\n There is a tabline in Neovim. It shows all the opened tabs in your neovim.<\/p>\n\n\n\n
You can show the tabline using the option showtabline<\/code>. Set it to:<\/p>\n\n\n\n\n0<\/code> to never show it,<\/li>\n\n\n\n1<\/code> to show only when there is more than 1 tab. Use it for small-screen devices.<\/strong><\/li>\n\n\n\n2<\/code> to show the tabline always. Use it if you have a big screen <\/strong>and want your nvim to look fancy.<\/li>\n<\/ul>\n\n\n\nset showtabline=1<\/code><\/pre>\n\n\n\nfig: tabline in vim\/neovim – the top line showing tabs<\/figcaption><\/figure>\n\n\n\nHow to turn off INSERT, VISUAL, and other messages shown at the bottom<\/h2>\n\n\n\n By default, neovim shows its mode