Please critique my configuration!

alias hen='f(){ docker run -it --rm -v $(pwd):/src hendry/nvim:latest; unset -f f; }; f'

to quickly try my Docker image GitHub - kaihendry/nvim: Reproducing my editing environment for your entertainment

Still some things I have not figured out:

  • autoformatting javascript code, should I be use deno instead of typescript-language-server-bin ?
  • color schemes incapable of showing my tabs nicely, dracula and tab list char not legible · Issue #14 · tanvirtin/monokai.nvim · GitHub fails for me
  • I don’t see the benefit of nvim-treesitter, esp since it does things on load
  • I’m assuming telescope uses rg/fd but I’m not sure or how to check
  • Ideally want a way of quickly looking through a file’s git history, whole file, not just diffs

Thanks guys, I have been enjoying myself!

autoformatting javascript code, should I be use deno instead of typescript-language-server-bin ?

Generally deno is not intended to run on node projects and vice versa. Many people are using null-ls, I personally would recommend formatter.nvim if you just want formatting (or using formatprg)

color schemes incapable of showing my tabs nicely, dracula and tab list char not legible · Issue #14 · tanvirtin/monokai.nvim · GitHub fails for me

Why not just override the particular highlight group applied to tab list char?

vim.cmd [[set runtimepath=$VIMRUNTIME]]
vim.cmd [[set packpath=/tmp/nvim/site]]

local package_root = '/tmp/nvim/site/pack'
local install_path = package_root .. '/packer/start/packer.nvim'

local function load_plugins()
  require('packer').startup {
    {
      'wbthomason/packer.nvim',
      'joshdick/onedark.vim' -- Theme inspired by Atom
    },
    config = {
      package_root = package_root,
      compile_path = install_path .. '/plugin/packer_compiled.lua',
    },
  }
end

_G.load_config = function()
  vim.o.termguicolors = true
  vim.cmd [[ autocmd ColorScheme * highlight Whitespace ctermfg=red guifg=#FF0000 ]]
  vim.cmd [[ colorscheme onedark ]]
  vim.cmd [[ set list ]]
  vim.cmd [[ set listchars=tab:>- ]]
end

if vim.fn.isdirectory(install_path) == 0 then
  vim.fn.system { 'git', 'clone', 'https://github.com/wbthomason/packer.nvim', install_path }
  load_plugins()
  require('packer').sync()
  vim.cmd [[autocmd User PackerComplete ++once lua load_config()]]
else
  load_plugins()
  require('packer').sync()
  _G.load_config()
end

I don’t see the benefit of nvim-treesitter, esp since it does things on load

I’m not sure what you mean. nvim-treesitter gives you access to the syntax tree. This lets you do a ton of cool things like more intelligent code navigation/text motions (you can yank functions/classes), incremental selection up the AST, more intelligent code highlighting, within-class rename, selective spellchecking in comments, etc.

I’m assuming telescope uses rg/fd but I’m not sure or how to check

It should “just work” if both are on your path

Ideally want a way of quickly looking through a file’s git history, whole file, not just diffs

You can use 0Gclog from fugitive, I think Neogit also has an equivalent.

Thank you Michael. For formatting I’m now using https://www.reddit.com/r/neovim/comments/qt1cyp/critique_my_configuration/hkh3c6t/ and it’s working great! I’m using the typescript server to format, not prettier btw.

https://s.natalian.org/2021-11-14/treesitter.mp4 is the treesitter behaviour on startup via my Docker image I am looking to avoid.

Another question whilst I’m thinking of it. Is there a way to list my key binds? For example just showing my leader binds would be a start. I keep forgetting them!

https://s.natalian.org/2021-11-14/treesitter.mp4 is the treesitter behaviour on startup via my Docker image I am looking to avoid.

That one is totally easy :slight_smile: You just need to pre-compile your tree-sitter grammars. You can just add a “TSInstallSync” call (capitalization may be incorrect) when you are bootstrapping your config while building the container (After your PackerInstall in a second run comand).

Another question whilst I’m thinking of it. Is there a way to list my key binds? For example just showing my leader binds would be a start. I keep forgetting them!

You might be interested in which-key.nvim otherwise there is :Telescope keymaps

What is I didn’t want a compiler base-devel system in my Docker image for installing tree sitter btw? Are there precompiled packages for when it needs I wonder?

I’m not sure, but you can just do a multi-stage build and copy the tree-sitter parsers from stage 0 to stage 1 without introducing a dependcy on the c toolchain (although, neovim needs libgcc anyways)

Why does neovim need libgcc btw?

docker/Dockerfile at master · lourenci/docker · GitHub worries me, hopefully neovim 6.x doesn’t require glibc!? :pray:

When neovim 6.0 releases in 20 years we will worry about that. 0.6 compiles fine with the same dependencies 0.5 did:

Neovim has always needed to dynamically link against glibc, see https://github.com/neovim/neovim/issues/6575

If you try running without libgcc on alpine:

Error loading shared library libgcc_s.so.1: No such file or directory (needed by /usr/local/bin/nvim)

Neovim requiring glibc is a bit of a bummer to say the least!!

I don’t quite understand why neovim requires glibc from statically linked build · Issue #6575 · neovim/neovim · GitHub

Is it because of dlopen?

Actually it doesn’t require glibc, it requires linking against libgcc_s.so.1 for some things that can’t be inlined, I think it’s fine linking against musl in alpine (this isn’t really my field of expertise).

I don’t see why this is a big deal, even with the dependencies it’s ~ an 5 mb container.

1 Like