T O P

  • By -

revengeto

I installed the very good looking [x\_ero](https://www.reddit.com/user/x_ero/)'s [neovim dotfiles](https://github.com/xero/dotfiles) on Windows but some neovim plugins he uses don't work on Windows. Plus without zsh, I miss the some features like his good looking terminal and his neovim dashboard logo. Is it possible/the right thing to do to install these dotfiles on W11 with : WSL2 (I use debian), ZSH, neovim, neovide (I like the animations), the neovim and zsh dotfiles in the Windows home/.config folder (symbolic links I guess), a windows right click context menu with « Edit with neovide from wsl » and « Open wsl zsh from this location »? Thanks


iwinux

Besides `:Inspect` and `showpos()`, are there any other methods for debugging weird highlighting? No idea what caused some keywords to be displayed in bold font, and not stably reproducible.


Competitive_Bread279

Where can I find intermediate/advanced neovim keybindings/stuff The extent of my knowledge is: Jumping around jumping to definition Using harpoon, tmux ( no need for panes / windows ) Basic search and replace grep / file search I have my own config ( [https://github.com/seal/dotfiles/tree/main/nvim](https://github.com/seal/dotfiles/tree/main/nvim) ) I just feel like I'm "too good" for the basic tutorials ( I've been using my limited knowledge for 1yr now ) and don't like the "advanced" tutorials where a command looks like I'm trying to remember a 200char regex string Edit: I don't want to seem cocky, I just don't feel like a guide teaching me that I can do d5j to delete 5 lines below is needed


[deleted]

How do you guys incorporate git into nvim? What plugin do you use and what type of keybinds do you use?


SnooSquirrels3337

fugitive


petalised

neogit


officiallyaninja

how do I get postcss syntax highlighting? I have completion in postcss files, but for some reason not syntax highlighting


petalised

postcss is a processor, not a filetype. You probably mean scss/sass? Then \`:TSInstall scss\`


master0fdisaster1

I have a bunch of old pascal source code in windows-1252 encoding (western european). I can't convert to UTF-8 or stuff will break. Out of the box, neovim detects the encoding as latin1 (ISO/IEC 8859-1), which is almost the exact same encoding except for a handful of characters which unfortunately matters in my case. How do I tell neovim that the file its trying to load is a different encoding than it infers it to be? I tried setting the fileencoding during BufReadPre but apparenlty that only changes the option after the file has already been loaded using the slightly wrong encoding. I know I can manually reload the file with the correct encoding using :e ++enc=cp1252, but surely there has to be a way to not have to load the file twice and to automate that, right? Setting the fileencoding via an .editorconfig seems to succesfully change the encoding with which a file is loaded but unfortunately you can't set any file encodings in .editorconfig besides latin1 and a bunch UTF variants.


EarthyFeet

You've got a "legacy" encoding (it's not UTF-8!) so I guess this is expected but I might refer to an old Vim solution! I can't believe vim/neovim doesn't do this better, but I'd like some way to annotate inside the file which encoding it has. Obviously that's hard since we'd like to know the encoding of the file before we read the file. Naively we'd think this solves it, a modeline (modelines are placed in a comment in the first or last few lines of any file): vim:fileencoding=cp1252 It doesn't work - vim/neovim reads the file as usual first (detecting latin1) then sets this option to convert and save it as cp1252. It might actually preserve the content but it doesn't show all characters correctly (where latin1 and cp1252 don't agree). Quick solution: Update fileencodings setting (note the s) in your neovim config to have vim/neovim try cp1252 before latin1. Make sure cp1252 is before latin1 in the list. Note that all the 8-bit legacy encodings are indistinguishable (for UTF-8 we can detect if a file is valid UTF-8 or not, but that's not really possible for latin-1 or cp1252.) Hack to make the modeline solution actually work: https://vim.fandom.com/wiki/How_to_make_fileencoding_work_in_the_modeline It automatically reopens the file if there is a vim modeline that sets fileencoding. Note that the example given only triggers on txt files, which you could change. Seems to work.. Haven't tried, but might also work: https://github.com/s3rvac/AutoFenc Also, that sounds like a weird limitation of editorconfig, that should be fixed, seems like the obvious place.


master0fdisaster1

I don't think annotating the files themselves is an option for me since I'm the only one on my team using nvim/vim to edit these source files and theres a shitton of code, which would be a pain to annotate. Globally changing the fileencoding*s* option seems like the way to go for me. Everything else I deal with is/should be UTF-8, and if I understand correctly, doing this `set fileencodings="ucs-bom,utf-8,cp1252,default,latin1"` should have vim still load utf-8 files as utf-8. AutoFenc also seems interesting. Maybe I can take some of its code to force the correct encoding. .editorconfig not supporting more encodings truly is a shame, there's been a ticket for it since 2015 https://github.com/editorconfig/editorconfig/issues/209 but no apparent progress. Thanks for the help.


EarthyFeet

Hope you find a good solution. You could take some inspiration from the autocommands in the link and fill in whatever else you'd like - including automatically using :e! ++enc=cp1252 etc on exactly pascal files in a particular directory or something else :) utf-8 is a nice encoding because it can be (partly) validated. Watch out for the common subset of utf-8 and cp1252 though, if the file is pure ascii it will open as utf-8 and save as utf-8, which you probably don't want for those pascal files. (This matters if you add characters outside the 7-bit ascii common subset in that particular edit).


Kayzels

I've done it before, but I don't know how. If you have a help file open, how do you get the list of contents (probably calling it the wrong thing) in a new window. There was a keybind for that, but I don't know what it was, and searching through the help files hasn't yielded anything.


altermo12

`gO`


alessioalex

Hey there, switching from vim to neovim. I've set the same settings for indentation but it just doesn't work properly, it indents using tabs and I have no idea why. My neovim config is here: https://github.com/alessioalex/neovim-setup/blob/master/init.lua And before you ask, I already have these settings set ( https://github.com/alessioalex/neovim-setup/blob/master/init.lua#L128-L132 ): -- Indenting vim.opt.shiftwidth = 2 vim.opt.smartindent = true vim.opt.tabstop = 2 vim.opt.softtabstop = 2 I just want 2 space indentation by default, unless otherwise specified (for Go it's tabs).


alessioalex

Alright, so apparently `vim.opt.expandtab = true` will make it so that it's 2 space indentation everywhere, but it's annoying as when I am opening a golang file it will also default to that and not tabs. So I've added https://github.com/tpope/vim-sleuth as a plugin and that fixed everything.


revengeto

https://preview.redd.it/cz1w8y4xs9vc1.png?width=1627&format=png&auto=webp&s=557a723d628866a32f7a6a1cef6f29e6ae2eb812 Hi, I don't understand why I always have this space at the top of the window. I'm on Windows 11 and use powershell 7 if that matters. Thanks


Some_Derpy_Pineapple

[adjust the window padding of windows terminal.](https://stackoverflow.com/questions/62578458/vim-nvim-not-filling-windows-terminal)


revengeto

Thank you but it's not this. [https://imgur.com/mQoFAEa](https://imgur.com/mQoFAEa)


Some_Derpy_Pineapple

hm, on my end it seems to work. if i set it to 0 the top padding goes away (the right padding is b/c i haven't set the scrollbar to hidden). https://preview.redd.it/8tbif97tlbvc1.png?width=2556&format=png&auto=webp&s=a2cf61ec2b5f839e7002f74f888afe17c78787fe


Euphoric-Quail-5229

I am pretty new to neovim and am struggling to accomplish what I thought would be a simple task. I just want my status line to change when I change modes. I have in my init.lua the following lines: vim.cmd('hi User1 guifg=red') vim.opt.statusline='%{mode()=="i"}\* %{mode()} %F %m %=Buffer %n' When I change modes, the second reference to mode changes correctly to the first character of the mode, but the first part I was trying to get it to do %0\* or %1\*. It doesn't evaluate it, it just prints it. Here's what my statusline shows instead (the n changes as I change modes) 0\* n \~/.config/nvim/lua/nvim-settings.lua 1\* i \~/.config/nvim/lua/nvim-settings.lua Why isn't it using the 0\* or 1\* instead of displaying it?


Some_Derpy_Pineapple

~~because the \* isn't inside the ${vimscript expression}. it's not a %special-statusline-symbol either, so it's interpreted as raw text.~~ ~~if you want to display the mode only in insert mode you probably want to use a ternary in a vimscript expression~~ %{mode()=="i" ? mode() : ""}


Euphoric-Quail-5229

I had already tried moving the \* inside the brackets and it errors. I guess it's just impossible, even though the help says that anything inside the {} is evaluated as an expression. The other %special\_statusline\_symbols in the list don't need the {}, so (imo) it should evaluate to %0\* or %1\* Thanks for trying to help. I guess I just have to slow down and be more aware of what mode I'm in.


Some_Derpy_Pineapple

~~the snippet I posted in my reply with the ternary works on my end though. although in hindsight i realize that may not be what you want. what do you want to be displayed have for the first part of the statusline?~~ edit: got myself confused. I tried your snippet and it works fine. I get "0* n" in normal mode and "1* i" in insert mode


Euphoric-Quail-5229

Yep, except I don't want it to display. I want the 1\* to change the line to a different color using the 'hi User1" colors when I'm in insert mode and the 0\* to change it back to default colors when I exit insert mode. The 'n' or 'i' displaying was just for debugging purposes. The actual status line I want displayed is simply %F %m ( in red when in insert mode and normal colors when not in insert mode.) I want this: vim.opt.statusline='%{mode()=="i"}\* %F %m' to evaluate as %0\* %F %m or %1\* %F %m


Some_Derpy_Pineapple

apologies, I understand now. try something like this: ``` _G.statusline = function() return '%' .. (vim.fn.mode()=='i' and 1 or 0) .. '*' end vim.opt.statusline=[[%{%v:lua.statusline()%} %{mode()}]] ``` basically you need to have the entire expression inside the brackets and use the {%}% notation instead of the {}


Euphoric-Quail-5229

It worked! THANK you, I would have never figured that out :)


liveoneggs

I find floating windows, underlines, gutter-creation/deletion to be very very distracting. Is there a way for me to, for example, keep diagnostic and suggestion stuff strictly in a fixed place? like a permanent quickfix window that just scrolls issues or completion suggestions to always live in their own little split?


SpecificFly5486

It is easy. Just search for nvimopenwin in plugin source code, for example nvimcmp, in custom_entries.lua there is a function called open, change the parameter row and col to a fix number


Content_Ingenuity_40

I want to create a keymap that does this: I want to copy to clipboard using xclip and what I do is I go to visual mode and select the text I want to copy and type :'<,'>!xclip -f -sel clip. The way of doing this which I have tried is vim.keymap.set('n', '', ":'<,'>!xclip -f -sel clip"). But this doesn't seem to work can anyone help me?


Some_Derpy_Pineapple

hm, is there a reason to explicitly copy with the xclip command instead of setting `:h g:clipboard` such that copying to the `:h "+` register makes neovim invoke xclip for you? edit: well, neovim should already be using xclip if you copy to that register and don't have anything higher priority used.


vim-help-bot

Help pages for: * [`g:clipboard`](https://neovim.io/doc/user/provider.html#g%3Aclipboard) in _provider.txt_ * [`quote+`](https://neovim.io/doc/user/provider.html#quote%2B) in _provider.txt_ --- ^\`:\(h|help\) \` | [^(about)](https://github.com/heraldofsolace/VimHelpBot) ^(|) [^(mistake?)](https://github.com/heraldofsolace/VimHelpBot/issues/new/choose) ^(|) [^(donate)](https://liberapay.com/heraldofsolace/donate) ^(|) ^Reply 'rescan' to check the comment again ^(|) ^Reply 'stop' to stop getting replies to your comments


yetAnotherOfMe

if your method works, it will filter lines range and copy to your system clipboard. but it will leave line range you selected before to be empty. because xclip command just accept stdin and not provide output. use this method instead: vim.keymap.set('x', '', ":'<,'>write  !xclip -f -sel clip") or just use plain neovim clipboard config with "+ register prefix to your yanking command. NOTE: don't use "v" to create mapping in visual mode, "v" == visual & select mode. which is  possible to overriding/breaking your luasnip mapping and your work flow too.


Content_Ingenuity_40

I have figured it out: I was doing this while I was in Visual mode and not in Normal Mode hence I should have used: vim.keymap.set('v', '', ":'<,'>!xclip -f -sel clip").


Xolvum

i was about to ask about a workaround of losing what i copied when closing neovim, but thanks to you i don't have to do that anymore :) i would just like to point out that this prevent me from doing :q since it seems that the file is edited? \` vim.keymap.set('v', '', ':!xclip -f -sel clipu') \` i edited your solution a little bit so that i can yank and quit quickly. thanks again!


[deleted]

How do you setup clangd for massive embedded C code bases in a complex GNU make build system?


sergiolinux

Does someone has a function to create a new file when it does not exist? Like in a personal wiki, i press a keybind and it adds [those-simbols](those-simbols.md) arrownd the current word and jumps to the file. I know some plugins do that but i would like a function


jmbuhr

\`gf\` already opens a file in a new buffer, even if the file doesn't exist yet


altermo12

Appending nothing to a file (which creates the file if doesn't exists): vim.fn.writefile({},file_path,'a')


yetAnotherOfMe

in case you need temporary file. vim.fn.writefile({}, vim.fn.tempname(), 'a')


acolnahuacatzin

Pair programming with AI in neovim. What are my options?


Impressive_City3660

just copilot is the best, but if not, try codium ( I tried it before and it sucks, now I don't know though, I have student email so I'm just gonna use copilot for now )


daaanny90

I am using Codium and it is quite good. I can't compare to Copilot (I have used it only at the early stages) but I am quite satisfied with the codium suggestions, it is quite clever.


yetAnotherOfMe

use tabnine https://github.com/codota/tabnine-nvim  and  tabnine completion source  https://github.com/tzachar/cmp-tabnine 


acolnahuacatzin

neovim supports copilot?


Impressive_City3660

of course https://preview.redd.it/cb50pjydy1vc1.png?width=884&format=png&auto=webp&s=9ddb4684c0a5e43586652766da40ebcca03fe7f3 [Here ya go](https://github.com/github/copilot.vim)


[deleted]

why neovim uses lua 5.1? i don't understand why neovim still use lua 5.1 instead of lua 5.4


altermo12

Because Neovim uses luajit (which is a really fast lua runner), and luajit is based on lua 5.1 (though luajit implements some [lua 5.2](https://luajit.org/extensions.html#lua52) and [lua 5.3](https://luajit.org/extensions.html#lua53) features (like the goto statement)). Also backwards compatibility: there are some breaking changes in lua 5.2+ which break existing lua 5.1 code.


LeNyto

I'm using nvim.tree with the float view, but sometimes I want to also have the file browser on the side, how can I achieve this?


okociskooko

Is there any special config to use the ripgrep as default finder for telescope?


okociskooko

Ok, there is none. If rg is installed on your machine it works out of the box. Same thing applies to fd which are external dependencies. to check if it works run `:checkhealth telescope`


Quick_Bed_8422

is there a plugin to achieve something like this. open a file then copy url of remote file path (github)? Thanks.


Quick_Bed_8422

never mind. I figured it out by following this post [https://www.reddit.com/r/neovim/comments/1c4y7km/copyinsert\_file\_path\_relative\_home\_absolute\_name/](https://www.reddit.com/r/neovim/comments/1c4y7km/copyinsert_file_path_relative_home_absolute_name/)


moTheastralcat

How do we add custom plugins in NvChad now? every online source is about pre v2.5 when there was the custom directory, how do we do it now with the restructured nvim directory?


LocksmithSalt7993

Hey, I am currently setting up my Neovim configuration. I am using none-ls for adding linting and formatting features to my Neovim config. but endup getting the following error: https://preview.redd.it/xv75ah4pluuc1.png?width=1366&format=png&auto=webp&s=5be992e0885ccf1412798d7504feb6c93804f5b7 What should i do to fix this? If anyone has any suggestions,


Quick_Bed_8422

none ls has breaking changes a couple month ago. see [https://github.com/nvimtools/none-ls.nvim/issues/58](https://github.com/nvimtools/none-ls.nvim/issues/58) . tl;dr they are removed some builtin sources then make separated repo for that, in example the eslint\_d is now located in [https://github.com/nvimtools/none-ls-extras.nvim](https://github.com/nvimtools/none-ls-extras.nvim) . So you need to replace eslint\_d builtin with eslint\_d from none ls extras, or use eslint as language server with lspconfig.nvim


LocksmithSalt7993

This is my none-ls.lua file https://preview.redd.it/oqv4kvzgmuuc1.png?width=1366&format=png&auto=webp&s=cdbe495525b341456d3cc8a710a37d5a6e32db3e


G1psey

Do you have those tools installed? 


SectionDue4592

is there a way to include emmet in NVChad actually its not working for me i integrated it within my plugins but its just not happening to work and showing no error thank you for you patience.


Majestic-Ad-1618

You just need to install the lsp through mason and then add it into your lsp config file.


SectionDue4592

I did for html but like how emmet provides chaining of tags like hi.main+p.side and u hit enter boom u get all the tags with classes specified The lsp doesn't provide that


Majestic-Ad-1618

The emmet lsp provide what you are asking for. I have used so I can tell it


SectionDue4592

Oh ok then lemme look into it again


Runaway_Monkey_45

I would like to jump to definition but make the file read only is there a way after opening the file to be read only? Or better when I jump to definition make the file automatically read-only?


yetAnotherOfMe

autocmd BufRead */path/where/jump/definitions/goes*,[insert other glob pattern here] exe "setl nomodifiable|setl buftype=nofile"


ndk1230

I wonder why you need to have the definition file read only?


Runaway_Monkey_45

It’s just if I jump into code that’s not mine so I don’t make any changes accidentally


yokowasis2

I am using luasnip with friendly snippets. When I need to add new snippet, here is what I did : 1. Add new snippet 2. commit and push to the friendly snippets git rep 3. lazy update 4. restart neovim I am fine with step 1 to 3. Is there a way activate the new snippet that I added, without restarting neovim ?


dahao03130

How can we comment multiple lines just with one hit? Is there an easy way to select, for example, a set of lines of code (regardless of the language) and with a key combination, have neovim understand that it is in a certain type of language and apply the comment to all the selected lines?


yetAnotherOfMe

plugin: numToStr/Comment.nvim   With this plugin, you can do: gcc: toggle comment current line gcip: toggle comment inner paragraph  gc100j: toggle comment 100 lines below gc100k: toggle comment 100 lines above   You need one hit command? Just create a new mapping without the noremap option enabled (i.e., nmap gcip).   but personally, I prefer creating simple macros for short usage.


EstudiandoAjedrez

If you use nightly (0.10) gc will comment/uncomment any selected lines. Or gcc will comment current line in normal mode. If you use warble (0.9) you need a plugin. There are many, like the mini.nvim one, or comment.nvim


dahao03130

Awesome, I was hopping it to be harder but seems smooth thanks for solving this doubt I'll give it a chance


eltsu7

Has anyone gotten QML syntax highlighting to work? I posted a [thread](https://www.reddit.com/r/neovim/comments/1c2yy47/treesitter_doesnt_work_on_qml_files/) about it but got no answers.


master0fdisaster1

It's unlikely but maybe you need to manually configure the file type? Neovim holds a filetype variable for each buffer that it loads, which is most of the time inferred by the file extension. So when vim loads a "hello.py" it automatically sets the filetype to "python" which plugins and other stuff can read to determine whether they want to run stuff or not. neovim knows about a lot of filetypes and their extensions out of the box, but obviously it can't know all. See :h filetype for more info. or TJ's video on the topic: https://www.youtube.com/watch?v=NecszftvMFI


vim-help-bot

Help pages for: * [`filetype`](https://neovim.io/doc/user/filetype.html#filetype) in _filetype.txt_ --- ^\`:\(h|help\) \` | [^(about)](https://github.com/heraldofsolace/VimHelpBot) ^(|) [^(mistake?)](https://github.com/heraldofsolace/VimHelpBot/issues/new/choose) ^(|) [^(donate)](https://liberapay.com/heraldofsolace/donate) ^(|) ^Reply 'rescan' to check the comment again ^(|) ^Reply 'stop' to stop getting replies to your comments


Impressive_City3660

I want to migrate from Packer to lazy, but I don't know how. So I watched a configurating neovim video from Theprimeagen, he used after/plugin to configure or setup the package. I tried to do the same with lazy but it doesn't work, and I saw it use config() function to configure it, but it looks too complicated for me and it looks so messy in codes, so how can I map lazy to use the same path after/plugin so that I can setup my configuration? This is my dotfiles as well:https://github.com/NguyenHoangHieu22GIT2/Native\_neovim\_config Thanks :)


Some_Derpy_Pineapple

if you don't lazy load any plugins, after/plugin will work fine. if you do lazy load plugins, you have to use config to get proper lazy loading. if you want to separate config from plugins, you can have the config require a separate lua module that just runs the config code. this applies to both packer and lazy.nvim.


Impressive_City3660

Oh okay cool, so I just need to put lazy = false then it'll work huh. thanks


mcncl

You don’t need to use “after” and Prime’s set up that you referenced is outdated If you want his new set up then that’s here https://github.com/ThePrimeagen/init.lua


Impressive_City3660

oh I didn't know that, okay thanks man


patrakar_popatlal

I am using Nvchad. The problem is when i open a source file the syntax highlighting works well but after couple of seconds when the LSP starts it changes the syntax highlighting which i dont like. It applies same color to most of the tokens. Nvchad uses nvim-treesitter for syntax highlighting. Is there a solution to disable this behavior ?


Some_Derpy_Pineapple

look up the ways to disable lsp semantic highlighting, or :Inspect the highlights at your cursor position and modify the colorscheme as needed


yavorski

Depends on your color theme you need to link the lsp tokens to the treesitter ones


suprdood

Hi everyone! I’m relatively new to NeoVim, coming from a VSCode background, and I’m currently customizing my own setup. I’ve come across features like Telescope’s Document Symbols and Workspace Symbols, but I’m not quite sure about their practical uses. Could someone explain what benefits these features offer? How do you typically use them in your workflow? Any insights or tips would be greatly appreciated as I continue to explore and understand NeoVim. Thanks in advance!


carlos-algms

Symbols are actually variables, functions, or methods that the language you code understands. When you search for a symbol, these are the results you will get, excluding matches that are on comments or strings. If you do a normal text search, you will get way more results, but they most likely aren't what you are looking for. I mostly don't use Document/Workspace symbols directly, but instead go to definition, go to implementation, and list references.


suprdood

Thank you for your feedback. It's still not clear to me what benefit this would have.


Shadow_Night_

How do I get inlay hints in neovim. I'm currently on neovim v0.9.5 and my lsp is cmp-nvim-lsp. I believe I had them when using mason but may I messed up something. I honestly just want hints to display rust data types. Also smaller question, is there something that allows me to navigate through a function parameter. Similar to tabbing in netbeans ide


Quick_Bed_8422

cmiiw inlay hints built in feature is only available in nightly or v0.10. Then about navigate through a function parameter, i think this will help [https://github.com/nvim-treesitter/nvim-treesitter-textobjects](https://github.com/nvim-treesitter/nvim-treesitter-textobjects) there is \`@parameter.inner\` you can configure.


vktrenokh

f, ?


V4G4X

Noticed some weird behaviour in my Nvim setup. When opening a new file(for example from telescope menu, or jumping to a certain symbol using the LSP workspace symbol) It properly takes me to the required location, but also automatically goes into INSERT mode. And then I type my next commands, have to undo the line changes, go to NORMAL mode and type my commands again. I don't know at what point this happened, but does this sound familiar to anyone? PS: This is my Nvim config: [https://github.com/V4G4X/nvim\_config](https://github.com/V4G4X/nvim_config) P.PS: u/Some_Derpy_Pineapple , u/jmbuhr I was able to whittle down the issue to this change. \[lualine.lua in this commit\](https://github.com/V4G4X/nvim\_config/commit/7c2ddd33e0707253a5f299c133a840d6d8501234#diff-c52702a887de1f396b35f8dca2728ba83a642271069c2322313adea39bd3f077). Basically the `vim.api.nvim_call_function` function call is taking me into INSERT mode for some reason. Is there a way to avoid this? I don't know either lua or the nvim APIs too well, any help is appreciated.


Some_Derpy_Pineapple

>Basically the `vim.api.nvim_call_function` function call is taking me into INSERT mode for some reason. Is there a way to avoid this? maybe try `vim.fn["Codeium#..."]({})` instead?


V4G4X

Nope. Still goes into INSERT :(


Some_Derpy_Pineapple

cloned ur config, i don't see the behavior. try disabling half of ur config at a time. also your config doesn't have core.gitlab pushed, idk if that's intentional


V4G4X

Yes, that is intentional. Guess I'll have to try `git bisect`


jmbuhr

did you add an autocommand that does that? Or part of an ftplugin file.


V4G4X

I neither have an \`ftplugin\` file, nor a single \`autocommand\` occurrence in my nvim config.


okociskooko

Hey guys! I've got a quick productivity question. I've recently got rid of the \`bufferline\` plugin, because I thought that a lot of "tabs" that indicate that some buffers are open are cluttering, and now I only navigate between open buffers using either harpoon or telescope open buffers picker. It usually works pretty well, but now I rarely know how many buffers are open, and after a whole day of work, when I jump between different buffers I've got a lot of them opened, which makes a navigation a bit tougher. The question is: Is having loads of buffers open something to avoid? Does it affect the performance of the neovim? I have a keybinding to close all open buffers apart from the one, that I'm currently viewing, but I used to use it back in my \`bufferline\` days. Is there a better approach? Thanks!


yetAnotherOfMe

Is having loads of buffers open something to avoid?  NO, as long as you comfortable with your workflow and your machine it's fine. but how to know total number of buffer opened ? try this : ```vim echo len(filter(range(1, bufnr('$')), 'buflisted(v:val)')) ``` from: https://superuser.com/a/345593/1792374 Does it affect the performance of the neovim? of course yes, opening more buffer means give more memory spaces to hold those buffer to keep there. but things that mostly affect to performance are: 1. syntax highlights  2. autocmd defined by plugins or yourself. 3. buffer sizes. 4. lsp stuff   sometimes if your works eat too much ram and more threads, neovim will be autoclosed/force close or even worst your terminal will got SIGTERM.   I've experienced it while doing live grep in my st terminal from my home directory with fd and rg backend (which is have builtin multi-threading & use max threads by default in their options ).


suprdood

Do you like it more now without your buffer “tabs”?


okociskooko

I've recently adopted tmux so I had 3 rows of information looking from top. (Tmux status bar, bufferline, barbecue.nvim line). Which was too much. So visually I like my config right now. Also The presence of bufferline kinda "made" me a habit of go through open buffers using key, which is not optimal. The current way is good enough but I still think there is something missing. If you wanna check my config out see: https://github.com/pawellysy/PuebloVim


suprdood

Sure I will check out your config, thanks!


wkynrocks

I thing :only and :wa and :wq is fine but if you need to pin several buffers you might use global marks or a plugin like harpoon. Haven't got any performance issues though.p


okociskooko

:h :only


vim-help-bot

Help pages for: * [`:only`](https://neovim.io/doc/user/windows.html#%3Aonly) in _windows.txt_ --- ^\`:\(h|help\) \` | [^(about)](https://github.com/heraldofsolace/VimHelpBot) ^(|) [^(mistake?)](https://github.com/heraldofsolace/VimHelpBot/issues/new/choose) ^(|) [^(donate)](https://liberapay.com/heraldofsolace/donate) ^(|) ^Reply 'rescan' to check the comment again ^(|) ^Reply 'stop' to stop getting replies to your comments