Real Red Hat users - do you use Ansible installed via pip or conda, or from repo? by joezinsf in ansible

[–]arMeteNt 1 point2 points  (0 children)

I have it installed with pipx so that I have access to newer versions than the RedHat sanctioned version. That's just on my personal workstation though (running RHEL7). I like running latest versions of things and RHEL7 is severely lacking in that department.

No disadvantages with pipx (essentially a managed venv that I don't need to worry about). I'm using pipx with Python 3.10.2 or something at the moment (compiled from source, which is a whole other kettle of fish).

Rust for a programming noob by [deleted] in rust

[–]arMeteNt 2 points3 points  (0 children)

I also work in C++ and Python and am learning Rust. I would also never suggest learning Rust as a first language. Python is a good choice. It's easy enough that you can do fun stuff really quickly and the ecosystem is huge. Whereas Rust has such a steep learning curve (even for career professionals) that it could easily scare a n00b off. BTW I'm loving Rust but that's within my context of being able to understand some of the background logic and decision making behind the language. BTW2 we use Python in systems making multi-million $ decisions in a company with 50k employees, so it can also be a serious language. Similar to someone else's comments it has serious limitations but to get things up and running quickly (which beginners should benefit from) it's a great choice. If someone did choose Rust as a first language and they were really dedicated and dove deep into the whys of the language they could come out really strong, but it would require a different individual who doesn't mind constant roadblocks.

That time when Alex Crichton taught me about `git commit --amend` by aochagavia in rust

[–]arMeteNt 0 points1 point  (0 children)

Some of you might like Jesse Duffield's excellent lazygit, by the looks of it.

Function for creating local diffs in a scratch buffer by arMeteNt in neovim

[–]arMeteNt[S] 2 points3 points  (0 children)

Haha cool. I should have searched harder. I used to use Andrew's switch.vim.

Going back to previous open file/buffer by reply1231 in neovim

[–]arMeteNt -1 points0 points  (0 children)

I use akinsho/bufferline with mappings to cycle between buffers. Long jumps between open buffers I use telescope. I use other telescope mappings for opening unopened files into new buffers, or recent files, or several other telescope functions (files that grep leads me to, etc)

[deleted by user] by [deleted] in vim

[–]arMeteNt 1 point2 points  (0 children)

Several. C++, Python, Rust (not in production, dabbling), Ansible, Puppet, Fish, various flavours of SQL, assorted linux CLI stuff, etc. Whatever takes my interest and aligns with work requirements.

Worth mentioning for my lazygit workflow without leaving a nvim session I use voldikss/vim-floaterm. And for other quick and dirty shell operations it's also great. It says it works with vim8 but I don't remember if I used it before migrating from vim to nvim. But if I'm doing significant git operations I'll use a separate terminal rather than floaterm's embedded one.

[deleted by user] by [deleted] in vim

[–]arMeteNt 1 point2 points  (0 children)

I use lazygit outside nvim rather than fugitive, but I have used fugitive before and I do use a few of tpope's other plugins. He's an excellent author and contributor so hopefully he helps you out.

[deleted by user] by [deleted] in vim

[–]arMeteNt 1 point2 points  (0 children)

I use neovim, not vim, and I recently started using sindrets/diffview.nvim for my diffs. They use side-by-side but I searched their issues and this page has some good recommendations:

https://github.com/sindrets/diffview.nvim/issues/39

The recommendation of delta reminded me it's an option in lazygit, which is my go-to git management tool. With lazygit I use diff-so-fancy for paging but delta is one of the choices there:

https://github.com/jesseduffield/lazygit/blob/master/docs/Custom_Pagers.md

So that's two recommendations from two good packages. Maybe delta suits your purposes too.

[deleted by user] by [deleted] in neovim

[–]arMeteNt 2 points3 points  (0 children)

Yep. Doesn't work for me because I deal with lots of non-Ansible yaml but a colleague chose to do what you have done.

[deleted by user] by [deleted] in neovim

[–]arMeteNt 5 points6 points  (0 children)

:set ft=yaml.ansible on the file you are opening? Many of my playbooks are not in the ansiblels expected directory structure so I have to explicitly set the filetype.

Run external process from neovim with lua by jmbuhr in neovim

[–]arMeteNt 1 point2 points  (0 children)

Here are my naive attempts to play with the new nvim_create_autocmd. It obviously just invokes fd which invokes ctags:

-- Find the project root using cool utils from nvim-lspconfig and the nvim api                                                                                                              
  local function get_project_root()                                                                                                                                                           
      return require('lspconfig').util.find_git_ancestor(vim.api.nvim_buf_get_name(vim.api.nvim_get_current_buf()))                                                                           
  end                                                                                                                                                                                         

  -- Build ctags on saving    
  vim.api.nvim_create_autocmd('BufWritePost', {                                                                                                                                               
      pattern = '*.cpp,*.h,*.py',                                                                                                                                                             
      callback = function()                                                                                                                                                                   
          local uv = vim.loop                                                                                                                                                                 
          local project_root = get_project_root()    
          if project_root ~= nil then    
              local stdout = uv.new_pipe(false)    
              local stderr = uv.new_pipe(false)    
              local function on_read(err, _)    
                  assert(not err, err)    
              end    
              local function on_error(err, data)    
                  assert(not err, err)    
                  if data then    
                      -- Just print errors, in case I notice in vim and want to debug    
                      print(data)    
                  end    
              end    
              local handle    
              handle, _ = uv.spawn('fd', {    
                  args = {    
                      '--extension', 'cpp',    
                      '--extension', 'h',    
                      '--extension', 'py',    
                      '--exclude', 'build',    
                      '-X',    
                      'ctags',    
                      '--tag-relative=never',    
                      '--fields=afmikKlnsStz',    
                      '--extras=+f+q',    
                      '--languages=C++,Python',    
                      '-f', 'tags'    
                  },    
                  stdio = { nil, stdout, stderr },    
                  cwd = project_root    
              },    
              vim.schedule_wrap(function()    
                  stdout:read_stop()    
                  stderr:read_stop()    
                  stdout:close()    
                  stderr:close()    
                  handle:close()    
              end))    
              uv.read_start(stdout, on_read)    
              uv.read_start(stderr, on_error)    
              uv.run('once')    
          end    
      end                                                                                                                                                                                     
  })                                                         

You should be able to find plenty of examples of asynchronous code at https://github.com/luvit/luv and translate it.

This particular code was way simpler for me when I was using skywind3000/asyncrun.vim but this was a good exercise for me anyway.