neovim configuration.

Coming back from Redcore-linux to FreeBSD as development now i have neovim under control.
What does not work : swift (no language server available for FreeBSD) & F#.
For less known languages zig,nim,odin i have,
https://forums.freebsd.org/threads...tives-nim-odin-zig-scala.101731/#post-745505

For all other languages , coc plugin is very powerfull, you get parameterlists with types when you enter functions.

Here the config,
cat init.vim
Code:
" In je init.vim (VimScript)
let g:coc_global_extensions = ['coc-tsserver', 'coc-json','coc-pyright','coc-sourcekit']

" 1. Alle Plugins in één blok
call plug#begin()

" Use release branch (recommended)
Plug 'https://github.com/folke/which-key.nvim.git'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'neoclide/coc-json', {'do': 'yarn install --frozen-lockfile'}
Plug 'https://github.com/JesseKPhillips/d.vim.git'
Plug 'https://github.com/lewis6991/satellite.nvim.git'

" Fuzzy Finder
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } " Install fzf binary
Plug 'junegunn/fzf.vim'                             " FZF Vim integration
Plug 'antoinemadec/coc-fzf'



Plug 'alaviss/nim.nvim'
Plug 'scalameta/nvim-metals'
Plug 'tetralux/odin.vim'
Plug 'ziglang/zig.vim'
Plug 'ionide/Ionide-vim'
Plug 'Olical/conjure'
Plug 'preservim/tagbar'
Plug 'preservim/nerdtree'

" Completion (nvim-cmp) & Snippets

Plug 'L3MON4D3/LuaSnip'

" UI & Look
Plug 'onsails/lspkind.nvim'
Plug 'stevearc/dressing.nvim'
Plug 'nvim-lualine/lualine.nvim'
Plug 'nvim-tree/nvim-web-devicons'
Plug 'ellisonleao/gruvbox.nvim'
Plug 'norcalli/nvim-colorizer.lua'

" Tools
Plug 'nvim-lua/plenary.nvim'
Plug 'ray-x/lsp_signature.nvim'
Plug 'folke/which-key.nvim'
Plug 'akinsho/toggleterm.nvim'
Plug 'kylechui/nvim-surround'
Plug 'guns/vim-sexp'
Plug 'tpope/vim-sexp-mappings-for-regular-people'
Plug 'akinsho/bufferline.nvim', { 'tag': '*' }
Plug 'ray-x/lsp_signature.nvim'

call plug#end()

" 2. Vim Settings
set background=dark
colorscheme gruvbox
set autoindent
set clipboard+=unnamedplus
set noexpandtab
set tabstop=4
set shiftwidth=4
set number
set termguicolors
set signcolumn=yes
set shortmess+=A " Voorkom 'ATTENTION' meldingen bij swap files
set shortmess+=I " Geen intro scherm
set shortmess+=c " Geen 'match 1 of 2' meldingen in de completion
set termguicolors " Essentieel voor mooie kleuren
set showtabline=2 " 0: nooit, 1: alleen bij >1 tab, 2: altijd
" Gebruik het systeem klembord voor alles (y, d, p)
set clipboard+=unnamedplus



" =============================================================================
" 3. Mappings & Settings
" =============================================================================

let g:conjure#client#scheme#stdio#command = "csi -quiet -:c"
let g:conjure#client#racket#stdio#command = "racket"

let mapleader = " "

" --- Algemene Instellingen ---
set encoding=utf-8
set nobackup
set nowritebackup
set updatetime=300
set signcolumn=yes
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}

" --- Interface & Navigatie ---
nmap <F8> :TagbarToggle<CR>
nnoremap <C-n> :NERDTreeToggle<CR>
nnoremap <silent><c-t> <Cmd>exe v:count1 . "ToggleTerm"<CR>
nnoremap <silent> <Esc> :noh<CR>

" Snel tussen splits bewegen
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l

" Buffer management (Tabline)
nnoremap <Tab> :BufferLineCycleNext<CR>
nnoremap <S-Tab> :BufferLineCyclePrev<CR>
nnoremap <leader>x :bdelete<CR>

" --- FZF (Zoeken) ---
nnoremap <leader>p :Files<CR>
nnoremap <leader>b :Buffers<CR>
nnoremap <leader>rg :Rg<CR>
nnoremap <leader>h :History:<CR>

" --- Klembord ---
" Plakken zonder register te overschrijven
xnoremap <leader>v "_dP
" Kopieer naar systeemklembord
nnoremap <leader>y "+y
vnoremap <leader>y "+y

" --- CoC Autocomplete (Tab & Enter) ---
inoremap <silent><expr> <TAB>
      \ coc#pum#visible() ? coc#pum#next(1) :
      \ CheckBackspace() ? "\<Tab>" :
      \ coc#refresh()
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
                              \: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"

function! CheckBackspace() abort
  let col = col('.') - 1
  return !col || getline('.')[col - 1]  =~# '\s'
endfunction

" --- CoC LSP Mappings ---
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
nnoremap <silent> K :call ShowDocumentation()<CR>

function! ShowDocumentation()
  if CocAction('hasProvider', 'hover')
    call CocActionAsync('doHover')
  else
    call feedkeys('K', 'in')
  endif
endfunction

nmap <leader>rn <Plug>(coc-rename)
nmap <leader>ac <Plug>(coc-codeaction-cursor)
nmap <leader>qf <Plug>(coc-fix-current)
nmap <leader>n  :CocCommand explorer<CR>

" --- CoC List Mappings (Spatie + toets) ---
nnoremap <silent><nowait> <space>a  :<C-u>CocList diagnostics<cr>
nnoremap <silent><nowait> <space>c  :<C-u>CocList commands<cr>
nnoremap <silent><nowait> <space>o  :<C-u>CocList outline<cr>
nnoremap <silent><nowait> <space>s  :<C-u>CocList -I symbols<cr>
nnoremap <silent><nowait> <space>p  :<C-u>CocListResume<CR>

" --- NERDTree Config ---
let g:NERDTreeCascadeOpenSingleChildDir = 0
let g:NERDTreeIgnore = ['^node_modules$', '^\.git$', '^\.cache$', '^\.nimble$', '^target$']
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif

" -- Stel je Leader key in (spatie is erg populair voor moderne setups)
" vim.g.mapleader = " "
" vim.g.maplocalleader = " "


"----------------------------------------------------------------------
lua << EOF
-- Schakel which-key in
require("which-key").setup {}


-- Voorbeeld van hoe je shortcuts groepeert zodat Which-Key ze mooi toont
local wk = require("which-key")
wk.add({
  { "<leader>f", group = "Bestand" }, -- Groep voor bestanden
  { "<leader>ff", "<cmd>Telescope find_files<cr>", desc = "Zoek Bestand" },
  { "<leader>n", group = "NERDTree" },
  { "<leader>nt", "<cmd>NERDTreeToggle<cr>", desc = "Toggle Tree" },
  { "<leader>c", group = "Code/LSP" },
})
EOF

lua << EOF
require('satellite').setup {
  current_only = false,
  winblend = 50,
  zindex = 40,
  excluded_filetypes = {},
  width = 2,
  handlers = {
    cursor = {
      enable = true,
      -- Supports any number of symbols
      symbols = { '⎺', '⎻', '⎼', '⎽' }
      -- symbols = { '⎻', '⎼' }
      -- Highlights:
      -- - SatelliteCursor (default links to NonText
    },
    search = {
      enable = true,
      -- Highlights:
      -- - SatelliteSearch (default links to Search)
      -- - SatelliteSearchCurrent (default links to SearchCurrent)
    },
    diagnostic = {
      enable = true,
      signs = {'-', '=', '≡'},
      min_severity = vim.diagnostic.severity.HINT,
      -- Highlights:
      -- - SatelliteDiagnosticError (default links to DiagnosticError)
      -- - SatelliteDiagnosticWarn (default links to DiagnosticWarn)
      -- - SatelliteDiagnosticInfo (default links to DiagnosticInfo)
      -- - SatelliteDiagnosticHint (default links to DiagnosticHint)
    },
    gitsigns = {
      enable = true,
      signs = { -- can only be a single character (multibyte is okay)
        add = "│",
        change = "│",
        delete = "-",
      },
      -- Highlights:
      -- SatelliteGitSignsAdd (default links to GitSignsAdd)
      -- SatelliteGitSignsChange (default links to GitSignsChange)
      -- SatelliteGitSignsDelete (default links to GitSignsDelete)
    },
    marks = {
      enable = true,
      show_builtins = false, -- shows the builtin marks like [ ] < >
      key = 'm'
      -- Highlights:
      -- SatelliteMark (default links to Normal)
    },
    quickfix = {
      signs = { '-', '=', '≡' },
      -- Highlights:
      -- SatelliteQuickfix (default links to WarningMsg)
    }
  },
}
EOF

lua << EOF
-- 3. Top Bar (Bufferline) Setup
require("bufferline").setup({
  options = {
    mode = "buffers",
    always_show_bufferline = true,
    separator_style = "slant",
    offsets = {
      {
        filetype = "nerdtree",
        text = "File Explorer",
        text_align = "left",
        separator = true
      }
    },
  }
})
EOF

lua << EOF
-- UI Modules
require('lualine').setup({ options = { theme = 'gruvbox', globalstatus = true }})
require('dressing').setup()
require('lsp_signature').setup({ floating_window = true, hint_enable = true })
require('colorizer').setup()
require('toggleterm').setup()
require('which-key').setup()
require('nvim-surround').setup()
require('gruvbox').setup({ transparent_mode = true })
EOF

lua << EOF
require("bufferline").setup({
  options = {
    mode = "buffers", -- Gebruik 'tabs' als je echte vim-tabs wilt, maar 'buffers' is gebruikelijker
    separator_style = "thin",
    numbers = "none",
    diagnostics = "nvim_lsp", -- Toont errors/warnings van je LSP's (Nim, Scala, etc.)
    offsets = {
      {
        filetype = "nerdtree",
        text = "File Explorer",
        text_align = "left",
         highlight = "Directory",
        separator = true
      }
    },
    show_buffer_icons = true,
    show_buffer_close_icons = true,
    separator_style = "slant", -- Opties: "slant", "thick", "thin"
  }
})

-- Handige keymaps om te switchen tussen bestanden
vim.keymap.set('n', '<Tab>', '<Cmd>BufferLineCycleNext<CR>', { silent = true })
vim.keymap.set('n', '<S-Tab>', '<Cmd>BufferLineCyclePrev<CR>', { silent = true })
EOF


lua << EOF
require('lualine').setup {
  options = {
    theme = 'gruvbox',
    icons_enabled = true,
    component_separators = { left = '', right = ''},
    section_separators = { left = '', right = ''}
  },
  sections = {
    lualine_a = {'mode'},
    lualine_b = {'branch', 'diff', 'diagnostics'},
    lualine_c = {'filename'},
    lualine_x = {'encoding', 'fileformat', 'filetype'},
    lualine_y = {'progress'},
    lualine_z = {'location'}
  }
}
EOF
" ---------------------------------------------------------------------
 
cat coc-settings.json
Code:
{
    "https.rejectUnauthorized": false,
    "http.proxyStrictSSL": false,
    "python.analysis.typeCheckingMode": "basic",
    "python.formatting.provider": "black",
    "python.linting.pylintEnabled": true,
    "python.venvPath": "~/.virtualenvs", 
    "languageserver": {
        "dlang": {
            "command": "serve-d",
            "filetypes": ["d"],
            "rootPatterns": ["dub.json", "dub.sdl", ".git/"],
            "initializationOptions": {},
            "settings": {}
        }
    }
}
 
What does this gives ?
- To the left you see a tree of your directory and files, which you can open.
- On top you have a bar with different files you opened
- There is a fuzzy finder to find files
- On bottom there is a statusline
- To the right there is a scrollbar.

Example editing python file,
test.png
 
Back
Top