feat: misc updates to neovim config
parent
23fbc255a2
commit
60985280b3
|
@ -8,11 +8,11 @@
|
||||||
vimdiffAlias = true;
|
vimdiffAlias = true;
|
||||||
withPython3 = true;
|
withPython3 = true;
|
||||||
extraPackages = with pkgs; [
|
extraPackages = with pkgs; [
|
||||||
ansible-language-server
|
|
||||||
beancount-language-server
|
beancount-language-server
|
||||||
black
|
black
|
||||||
docker-compose-language-service
|
docker-compose-language-service
|
||||||
efm-langserver
|
efm-langserver
|
||||||
|
fd
|
||||||
gcc
|
gcc
|
||||||
hlint
|
hlint
|
||||||
ltex-ls
|
ltex-ls
|
||||||
|
@ -22,6 +22,7 @@
|
||||||
nixpkgs-fmt
|
nixpkgs-fmt
|
||||||
nodePackages.dockerfile-language-server-nodejs
|
nodePackages.dockerfile-language-server-nodejs
|
||||||
nodePackages.pyright
|
nodePackages.pyright
|
||||||
|
ripgrep
|
||||||
ruff-lsp
|
ruff-lsp
|
||||||
shellcheck
|
shellcheck
|
||||||
shfmt
|
shfmt
|
||||||
|
@ -34,4 +35,5 @@
|
||||||
plugins = [ pkgs.vimPlugins.packer-nvim ];
|
plugins = [ pkgs.vimPlugins.packer-nvim ];
|
||||||
extraLuaConfig = builtins.readFile ./init.lua;
|
extraLuaConfig = builtins.readFile ./init.lua;
|
||||||
};
|
};
|
||||||
|
home.packages = [ pkgs.neovide ];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
-- luacheck: globals vim
|
-- luacheck: globals vim
|
||||||
|
|
||||||
require("packer").startup(function(use)
|
require("packer").startup(function(use)
|
||||||
use("tpope/vim-sensible")
|
use('nvim-tree/nvim-web-devicons')
|
||||||
|
|
||||||
use("vimwiki/vimwiki")
|
|
||||||
use("freitass/todo.txt-vim")
|
use("freitass/todo.txt-vim")
|
||||||
use("ledger/vim-ledger")
|
|
||||||
|
|
||||||
use("psliwka/vim-smoothie")
|
use("psliwka/vim-smoothie")
|
||||||
|
|
||||||
|
@ -17,12 +14,11 @@ require("packer").startup(function(use)
|
||||||
|
|
||||||
-- fern
|
-- fern
|
||||||
use("lambdalisue/fern.vim")
|
use("lambdalisue/fern.vim")
|
||||||
use("lambdalisue/nerdfont.vim")
|
|
||||||
use("lambdalisue/fern-renderer-nerdfont.vim")
|
|
||||||
use("lambdalisue/glyph-palette.vim")
|
use("lambdalisue/glyph-palette.vim")
|
||||||
use("lambdalisue/fern-git-status.vim")
|
use("lambdalisue/fern-git-status.vim")
|
||||||
use("lambdalisue/fern-mapping-git.vim") -- to check
|
use("lambdalisue/fern-mapping-git.vim") -- to check
|
||||||
use("lambdalisue/fern-hijack.vim")
|
use("lambdalisue/fern-hijack.vim")
|
||||||
|
use("TheLeoP/fern-renderer-web-devicons.nvim")
|
||||||
|
|
||||||
-- airline
|
-- airline
|
||||||
use("vim-airline/vim-airline")
|
use("vim-airline/vim-airline")
|
||||||
|
@ -49,7 +45,6 @@ require("packer").startup(function(use)
|
||||||
use("gruvbox-community/gruvbox")
|
use("gruvbox-community/gruvbox")
|
||||||
|
|
||||||
-- language support
|
-- language support
|
||||||
use("darrikonn/vim-gofmt")
|
|
||||||
use("Glench/Vim-Jinja2-Syntax")
|
use("Glench/Vim-Jinja2-Syntax")
|
||||||
use("preservim/vim-markdown")
|
use("preservim/vim-markdown")
|
||||||
use("LnL7/vim-nix")
|
use("LnL7/vim-nix")
|
||||||
|
@ -57,7 +52,6 @@ require("packer").startup(function(use)
|
||||||
use("LaTeX-Box-Team/LaTeX-Box")
|
use("LaTeX-Box-Team/LaTeX-Box")
|
||||||
use("vito-c/jq.vim")
|
use("vito-c/jq.vim")
|
||||||
use("tpope/vim-haml")
|
use("tpope/vim-haml")
|
||||||
use({ "psf/black", branch = "stable" })
|
|
||||||
use("elzr/vim-json")
|
use("elzr/vim-json")
|
||||||
|
|
||||||
use("jpalardy/vim-slime")
|
use("jpalardy/vim-slime")
|
||||||
|
@ -71,12 +65,26 @@ require("packer").startup(function(use)
|
||||||
use("L3MON4D3/LuaSnip") -- Snippets plugin
|
use("L3MON4D3/LuaSnip") -- Snippets plugin
|
||||||
use("lukas-reineke/lsp-format.nvim")
|
use("lukas-reineke/lsp-format.nvim")
|
||||||
|
|
||||||
|
use {
|
||||||
|
'nvim-telescope/telescope.nvim',
|
||||||
|
requires = { { 'nvim-lua/plenary.nvim' } }
|
||||||
|
}
|
||||||
|
use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make' }
|
||||||
|
|
||||||
use("sheerun/vim-polyglot")
|
use("sheerun/vim-polyglot")
|
||||||
|
|
||||||
use("nvim-treesitter/nvim-treesitter")
|
use("nvim-treesitter/nvim-treesitter")
|
||||||
use("nvim-orgmode/orgmode")
|
use("nvim-orgmode/orgmode")
|
||||||
|
use("akinsho/org-bullets.nvim")
|
||||||
|
use("lukas-reineke/headlines.nvim")
|
||||||
|
use("michaelb/sniprun")
|
||||||
|
use("dhruvasagar/vim-table-mode")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
vim.g.mapleader = ","
|
||||||
|
vim.g.maplocaleader = "\\"
|
||||||
|
|
||||||
|
|
||||||
local o = vim.opt
|
local o = vim.opt
|
||||||
|
|
||||||
local function map(mode, shortcut, command)
|
local function map(mode, shortcut, command)
|
||||||
|
@ -121,9 +129,6 @@ else
|
||||||
o.listchars = [[tab:> ,extends:>,precedes:<,nbsp:.,trail:_]]
|
o.listchars = [[tab:> ,extends:>,precedes:<,nbsp:.,trail:_]]
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.g.mapleader = ","
|
|
||||||
vim.g.maplocaleader = "\\"
|
|
||||||
|
|
||||||
o.splitbelow = true
|
o.splitbelow = true
|
||||||
o.splitright = true
|
o.splitright = true
|
||||||
nmap("<A-r>", "<C-w>r")
|
nmap("<A-r>", "<C-w>r")
|
||||||
|
@ -176,7 +181,7 @@ vim.g.markdown_syntax_conceal = 0
|
||||||
|
|
||||||
o.updatetime = 100 -- to make gigutter more responsive
|
o.updatetime = 100 -- to make gigutter more responsive
|
||||||
|
|
||||||
vim.g["fern#renderer"] = "nerdfont"
|
vim.g["fern#renderer"] = "nvim-web-devicons"
|
||||||
vim.cmd([[
|
vim.cmd([[
|
||||||
function! s:init_fern() abort
|
function! s:init_fern() abort
|
||||||
nmap <buffer> T <Plug>(fern-action-open:tab)
|
nmap <buffer> T <Plug>(fern-action-open:tab)
|
||||||
|
@ -196,11 +201,8 @@ augroup my-glyph-palette
|
||||||
autocmd FileType nerdtree,startify call glyph_palette#apply()
|
autocmd FileType nerdtree,startify call glyph_palette#apply()
|
||||||
augroup END
|
augroup END
|
||||||
]])
|
]])
|
||||||
nmap("<leader>t", ":Fern . -drawer -toggle<cr>")
|
nmap("<leader>tf", ":Fern . -drawer -toggle<cr>")
|
||||||
-- nmap("<leader>f", ":Files<cr>")
|
|
||||||
nmap("<leader>rg", ":Rg<cr>")
|
|
||||||
nmap("<leader><Bs>", ": cd ..<cr>")
|
nmap("<leader><Bs>", ": cd ..<cr>")
|
||||||
nmap("<leader>b", ": Buffers<cr>")
|
|
||||||
|
|
||||||
vim.g["indentLine_char"] = "▏"
|
vim.g["indentLine_char"] = "▏"
|
||||||
vim.g["indentLine_setConceal"] = 0
|
vim.g["indentLine_setConceal"] = 0
|
||||||
|
@ -234,7 +236,6 @@ lspconfig.ruff_lsp.setup { capabilities = capabilities }
|
||||||
|
|
||||||
lspconfig.nixd.setup { capabilities = capabilities }
|
lspconfig.nixd.setup { capabilities = capabilities }
|
||||||
lspconfig.jsonls.setup { capabilities = capabilities }
|
lspconfig.jsonls.setup { capabilities = capabilities }
|
||||||
lspconfig.ansiblels.setup { capabilities = capabilities }
|
|
||||||
lspconfig.beancount.setup { capabilities = capabilities }
|
lspconfig.beancount.setup { capabilities = capabilities }
|
||||||
lspconfig.ltex.setup { capabilities = capabilities }
|
lspconfig.ltex.setup { capabilities = capabilities }
|
||||||
|
|
||||||
|
@ -362,8 +363,15 @@ require("nvim-treesitter.configs").setup {
|
||||||
}
|
}
|
||||||
|
|
||||||
orgmode.setup {
|
orgmode.setup {
|
||||||
org_agenda_files = { "~/Nextcloud/org/*" },
|
org_agenda_files = { "~/Nextcloud/org/agenda/*.org" },
|
||||||
org_default_notes_file = "~/Nextcloud/org/refile.org",
|
org_default_notes_file = "~/Nextcloud/org/notes.org",
|
||||||
|
org_capture_templates = {
|
||||||
|
w = {
|
||||||
|
description = "Wishlist",
|
||||||
|
template = "* %x",
|
||||||
|
target = "~/Nextcloud/org/wishlist.org"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd("LspAttach", {
|
vim.api.nvim_create_autocmd("LspAttach", {
|
||||||
|
@ -372,9 +380,51 @@ vim.api.nvim_create_autocmd("LspAttach", {
|
||||||
-- Enable completion triggered by <c-x><c-o>
|
-- Enable completion triggered by <c-x><c-o>
|
||||||
vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc"
|
vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc"
|
||||||
|
|
||||||
|
-- Buffer local mappings.
|
||||||
|
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||||
local opts = { buffer = ev.buf }
|
local opts = { buffer = ev.buf }
|
||||||
vim.keymap.set("n", "<C-f>", function()
|
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
|
||||||
vim.lsp.buf.format({ async = true })
|
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
|
||||||
|
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
|
||||||
|
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts)
|
||||||
|
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts)
|
||||||
|
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, opts)
|
||||||
|
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, opts)
|
||||||
|
vim.keymap.set('n', '<space>wl', function()
|
||||||
|
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||||
|
end, opts)
|
||||||
|
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, opts)
|
||||||
|
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, opts)
|
||||||
|
vim.keymap.set({ 'n', 'v' }, '<space>ca', vim.lsp.buf.code_action, opts)
|
||||||
|
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
|
||||||
|
vim.keymap.set('n', '<space>f', function()
|
||||||
|
vim.lsp.buf.format { async = true }
|
||||||
end, opts)
|
end, opts)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
local telescope_builtin = require('telescope.builtin')
|
||||||
|
vim.keymap.set('n', '<leader>ff', telescope_builtin.find_files, {})
|
||||||
|
vim.keymap.set('n', '<leader>fg', telescope_builtin.live_grep, {})
|
||||||
|
vim.keymap.set('n', '<leader>fb', telescope_builtin.buffers, {})
|
||||||
|
vim.keymap.set('n', '<leader>fh', telescope_builtin.help_tags, {})
|
||||||
|
|
||||||
|
local telescope = require("telescope")
|
||||||
|
telescope.setup {
|
||||||
|
extensions = {
|
||||||
|
fzf = {
|
||||||
|
fuzzy = true, -- false will only do exact matching
|
||||||
|
override_generic_sorter = true, -- override the generic sorter
|
||||||
|
override_file_sorter = true, -- override the file sorter
|
||||||
|
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
|
||||||
|
-- the default case_mode is "smart_case"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
telescope.load_extension("fzf")
|
||||||
|
|
||||||
|
require'nvim-web-devicons'.setup()
|
||||||
|
|
||||||
|
if vim.g.neovide then
|
||||||
|
vim.o.guifont = "Hack Nerd Font:h10"
|
||||||
|
end
|
||||||
|
|
Loading…
Reference in New Issue