custom neovim

master
Dustin Swan 2 years ago
parent 7b3cd030fe
commit 91cbdd4eaa
Signed by: dustinswan
GPG Key ID: AB49BD6B2B3A6377

@ -7,7 +7,7 @@ in
home.stateVersion = "18.09"; home.stateVersion = "18.09";
home.packages = with pkgs; [ # magic-wormhole home.packages = with pkgs; [ # magic-wormhole
ripgrep fd mosh w3m nnn hexyl wget httpie timg sox du-dust duplicati bitwarden-cli gnupg gpg-tui rage sd libqalculate glow spotify-tui spotifyd amfora duf pandoc pastel jq jo fx jc miller visidata sc-im cacert weechat ddgr ripgrep fd mosh w3m nnn hexyl wget httpie timg sox du-dust restic bitwarden-cli gnupg gpg-tui rage sd libqalculate glow spotify-tui spotifyd amfora duf pandoc pastel jq jo fx jc miller sc-im cacert weechat ddgr # visidata
nixfmt shellcheck vale tectonic zathura # lilypond-with-fonts nixfmt shellcheck vale tectonic zathura # lilypond-with-fonts
nodejs deno yarn nodePackages.typescript-language-server nodePackages.stylelint nodePackages.js-beautify nodePackages.expo-cli nodejs deno yarn nodePackages.typescript-language-server nodePackages.stylelint nodePackages.js-beautify nodePackages.expo-cli
ocaml dune_2 ocamlPackages.utop ocamlPackages.ocp-indent ocamlPackages.merlin ocaml dune_2 ocamlPackages.utop ocamlPackages.ocp-indent ocamlPackages.merlin

@ -1,8 +1,9 @@
vim.g.mapleader = ' ' vim.g.mapleader = ' '
vim.g.maplocalleader = '\\' vim.g.maplocalleader = ','
vim.g.loaded_netrw = 1 vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1 vim.g.loaded_netrwPlugin = 1
vim.opt.timeoutlen = 100
vim.opt.number = true vim.opt.number = true
vim.opt.mouse = 'a' vim.opt.mouse = 'a'
vim.opt.ignorecase = true vim.opt.ignorecase = true
@ -12,6 +13,9 @@ vim.opt.tabstop = 2
vim.opt.shiftwidth = 2 vim.opt.shiftwidth = 2
vim.opt.termguicolors = true vim.opt.termguicolors = true
vim.opt.completeopt = "menu,menuone,noselect" vim.opt.completeopt = "menu,menuone,noselect"
vim.opt.cursorline = true
vim.api.nvim_create_autocmd("FileType", { pattern = { "org" }, command = "setlocal nowrap" })
require('packer').startup(function(use) require('packer').startup(function(use)
use 'wbthomason/packer.nvim' use 'wbthomason/packer.nvim'
@ -25,6 +29,7 @@ require('packer').startup(function(use)
use 'mfussenegger/nvim-dap' use 'mfussenegger/nvim-dap'
use 'lukas-reineke/indent-blankline.nvim' use 'lukas-reineke/indent-blankline.nvim'
use 'LnL7/vim-nix' use 'LnL7/vim-nix'
use 'AndrewRadev/splitjoin.vim'
use { use {
'nvim-telescope/telescope.nvim', 'nvim-telescope/telescope.nvim',
@ -82,7 +87,13 @@ require('packer').startup(function(use)
use { use {
"folke/which-key.nvim", "folke/which-key.nvim",
config = function() config = function()
require("which-key").setup() require("which-key").setup({
plugins = {
spelling = {
enabled = true
}
}
})
end end
} }
@ -111,7 +122,7 @@ require('packer').startup(function(use)
config = function() config = function()
require("noice").setup() require("noice").setup()
require("notify").setup({ require("notify").setup({
background_colour = "#000000" -- #1a1b26", background_colour = "#000000"
}) })
end, end,
requires = { requires = {
@ -119,98 +130,30 @@ require('packer').startup(function(use)
"rcarriga/nvim-notify", "rcarriga/nvim-notify",
} }
}) })
use "rafamadriz/friendly-snippets"
use({
"L3MON4D3/LuaSnip",
tag = "v<CurrentMajor>.*",
config = function()
require("luasnip.loaders.from_vscode").lazy_load()
end
})
use 'hrsh7th/cmp-nvim-lsp'
use 'hrsh7th/cmp-buffer'
use 'hrsh7th/cmp-path'
use 'hrsh7th/cmp-cmdline'
use 'saadparwaiz1/cmp_luasnip'
use 'dmitmel/cmp-digraphs'
use 'uga-rosa/cmp-dictionary'
use 'kdheepak/cmp-latex-symbols'
use { use {
'hrsh7th/nvim-cmp', 'VonHeikemen/lsp-zero.nvim',
config = function () requires = {
local has_words_before = function() -- LSP Support
local line, col = unpack(vim.api.nvim_win_get_cursor(0)) {'neovim/nvim-lspconfig'},
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil {'williamboman/mason.nvim'},
end {'williamboman/mason-lspconfig.nvim'},
local luasnip = require("luasnip") -- Autocompletion
local cmp = require("cmp") {'hrsh7th/nvim-cmp'},
{'hrsh7th/cmp-buffer'},
cmp.setup({ {'hrsh7th/cmp-path'},
snippet = { {'saadparwaiz1/cmp_luasnip'},
expand = function(args) {'hrsh7th/cmp-nvim-lsp'},
require'luasnip'.lsp_expand(args.body) {'hrsh7th/cmp-nvim-lua'},
end
}, -- Snippets
{'L3MON4D3/LuaSnip'},
sources = { {'rafamadriz/friendly-snippets'},
{ name = 'luasnip' }, },
{ name = 'buffer' },
{ name = 'path' },
{ name = 'nvim_lsp' },
-- { name = 'digraphs' },
{ name = "latex_symbols" },
{ name = 'dictionary', keyword_length = 2 },
},
mapping = {
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = false,
},
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
}
})
end
}
use {
'neovim/nvim-lspconfig',
config = function()
-- require'lspconfig'.eslint.setup{}
require'lspconfig'.tsserver.setup{}
end
}
use {
"williamboman/mason.nvim",
config = function() config = function()
require("mason").setup() local lsp = require('lsp-zero')
lsp.preset('recommended')
lsp.setup()
end end
} }
@ -218,10 +161,14 @@ require('packer').startup(function(use)
'numToStr/Comment.nvim', 'numToStr/Comment.nvim',
config = function() config = function()
require('Comment').setup({ require('Comment').setup({
-- toggler = { toggler = {
-- line = '<leader>cc', line = '<leader>cc',
-- block = '<leader>cb', block = '<leader>cb',
-- } },
opleader = {
line = '<leader>cc',
block = '<leader>cb',
}
}) })
end end
} }
@ -283,13 +230,7 @@ require('packer').startup(function(use)
use { use {
"akinsho/toggleterm.nvim", tag = '*', config = function() "akinsho/toggleterm.nvim", tag = '*', config = function()
require("toggleterm").setup({ require("toggleterm").setup({ direction = 'float' })
open_mapping = [[<c-t>]],
direction = 'float',
float_opts = {
border = "curved"
}
})
end end
} }
@ -313,6 +254,13 @@ local wk = require("which-key")
wk.register({ wk.register({
["<leader>"] = { ["<leader>"] = {
a = { ":Alpha<cr>", "Alpha" },
b = {
name = "Buffer",
d = { ":bdelete!<cr>", "Delete" },
},
c = "Comment",
e = { ":NvimTreeToggle<cr>", "File Tree" },
f = { f = {
name = "Find", name = "Find",
f = { "<cmd>Telescope find_files<cr>", "Files" }, f = { "<cmd>Telescope find_files<cr>", "Files" },
@ -320,20 +268,23 @@ wk.register({
r = { "<cmd>Telescope oldfiles<cr>", "Recent Files" }, r = { "<cmd>Telescope oldfiles<cr>", "Recent Files" },
b = { "<cmd>Telescope buffers<cr>", "Buffers" }, b = { "<cmd>Telescope buffers<cr>", "Buffers" },
}, },
b = { J = { ":SplitjoinJoin<cr>", "Join" },
name = "buffer",
d = { ":bdelete!<cr>", "Delete" },
},
e = { ":NvimTreeToggle<cr>", "File Tree" },
t = { t = {
name = "Table", name = "Table",
t = { ":TableModeRealign", "Realign" }, m = "Toggle Table Mode",
t = "Tableize",
r = { ":TableModeRealign<cr>", "Realign" },
e = { ":TableEvalFormulaLine<cr>", "Evaluate" },
},
o = "Org",
p = {
name = "Packer",
s = { ":PackerSync<cr>", "Sync" },
}, },
S = { ":source %<cr>", "Source current file" }, S = { ":SplitjoinSplit<cr>", "Split" },
T = { ":TroubleToggle<cr>", "Trouble" }, T = { ":TroubleToggle<cr>", "Trouble" },
ps = { ":PackerSync<cr>", "Packer Sync" },
[";"] = { ":Alpha<cr>", "Alpha" },
}, },
["<S-l>"] = { ":BufferLineCycleNext<cr>", "Next Tab" }, ["<S-l>"] = { ":BufferLineCycleNext<cr>", "Next Tab" },
["<S-h>"] = { ":BufferLineCyclePrev<cr>", "Previous Tab" }, ["<S-h>"] = { ":BufferLineCyclePrev<cr>", "Previous Tab" },
["<C-t>"] = { ":ToggleTerm<cr>", "Terminal" },
}) })

Loading…
Cancel
Save