initial home-manager setup with neovim and starship
This commit is contained in:
parent
9a45f4f10a
commit
71c45e8397
6 changed files with 235 additions and 0 deletions
36
neovim/coc.part.lua
Normal file
36
neovim/coc.part.lua
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
-- https://raw.githubusercontent.com/neoclide/coc.nvim/master/doc/coc-example-config.lua
|
||||
|
||||
-- Some servers have issues with backup files, see #649
|
||||
vim.opt.backup = false
|
||||
vim.opt.writebackup = false
|
||||
|
||||
-- Having longer updatetime (default is 4000 ms = 4s) leads to noticeable
|
||||
-- delays and poor user experience
|
||||
vim.opt.updatetime = 300
|
||||
|
||||
-- Always show the signcolumn, otherwise it would shift the text each time
|
||||
-- diagnostics appeared/became resolved
|
||||
vim.opt.signcolumn = "yes"
|
||||
|
||||
local keyset = vim.keymap.set
|
||||
-- Autocomplete
|
||||
function _G.check_back_space()
|
||||
local col = vim.fn.col('.') - 1
|
||||
return col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') ~= nil
|
||||
end
|
||||
|
||||
-- Use Tab for trigger completion with characters ahead and navigate
|
||||
-- NOTE: There's always a completion item selected by default, you may want to enable
|
||||
-- no select by setting `"suggest.noselect": true` in your configuration file
|
||||
-- NOTE: Use command ':verbose imap <tab>' to make sure Tab is not mapped by
|
||||
-- other plugins before putting this into your config
|
||||
local opts = {silent = false, noremap = true, expr = true, replace_keycodes = false}
|
||||
keyset("i", "<TAB>", 'coc#pum#visible() ? coc#pum#next(1) : v:lua.check_back_space() ? "<TAB>" : coc#refresh()', opts)
|
||||
keyset("i", "<S-TAB>", [[coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"]], opts)
|
||||
|
||||
-- Make <CR> to accept selected completion item or notify coc.nvim to format
|
||||
-- <C-g>u breaks current undo, please make your own choice
|
||||
keyset("i", "<cr>", [[coc#pum#visible() ? coc#pum#confirm() : "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"]], opts)
|
||||
|
||||
-- Use <c-space> to trigger completion
|
||||
keyset("i", "<c-space>", "coc#refresh()", {silent = true, expr = true})
|
||||
41
neovim/default.nix
Normal file
41
neovim/default.nix
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
{config, pkgs, ...}:
|
||||
{
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
vimdiffAlias = true;
|
||||
coc = {
|
||||
enable = true;
|
||||
settings = {
|
||||
"zig.enabled" = true;
|
||||
"zig.startUpMessage" = true;
|
||||
"zig.path" = "${pkgs.zls}/bin/zls";
|
||||
"zig.debugLog" = false;
|
||||
};
|
||||
};
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
oil-nvim
|
||||
nvim-colorizer-lua
|
||||
nvim-treesitter
|
||||
mini-nvim
|
||||
plenary-nvim
|
||||
telescope-nvim
|
||||
gitsigns-nvim
|
||||
vim-airline
|
||||
nvim-web-devicons
|
||||
vim-startify
|
||||
nvim-lspconfig
|
||||
everforest
|
||||
tokyonight-nvim
|
||||
];
|
||||
extraLuaConfig = with builtins; (
|
||||
concatStringsSep "\n" (
|
||||
map readFile [
|
||||
./init.lua
|
||||
./coc.part.lua
|
||||
])
|
||||
);
|
||||
};
|
||||
|
||||
}
|
||||
35
neovim/init.lua
Normal file
35
neovim/init.lua
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
vim.opt.number = true
|
||||
vim.opt.tabstop = 4
|
||||
vim.opt.shiftwidth = 4
|
||||
vim.opt.undofile = true
|
||||
vim.opt.clipboard = "unnamedplus"
|
||||
vim.cmd [[
|
||||
highlight Normal guibg=none
|
||||
highlight NonText guibg=none
|
||||
highlight Normal ctermbg=none
|
||||
highlight NonText ctermbg=none
|
||||
]]
|
||||
vim.cmd.colorscheme "tokyonight-night";
|
||||
-- Disable netrw first:
|
||||
vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
vim.diagnostic.config({
|
||||
virtual_text = true,
|
||||
})
|
||||
require("oil").setup({
|
||||
default_file_explorer = true,
|
||||
})
|
||||
vim.lsp.config['rust-analyzer'] = {
|
||||
cmd = { 'rust-analyzer' },
|
||||
filetypes = { 'rust' },
|
||||
root_markers = { {'Cargo.toml', 'Cargo.lock'} },
|
||||
}
|
||||
vim.lsp.enable('rust-analyzer')
|
||||
-- Keymaps
|
||||
vim.keymap.set("n", "-", require("oil").open, { desc = "Open Oil" })
|
||||
vim.keymap.set("n", "<leader>-", require("oil").open_float, { desc = "Open Oil float" })
|
||||
local builtin = require('telescope.builtin')
|
||||
vim.keymap.set('n', '<leader>ff', builtin.find_files, { desc = 'Telescope find files' })
|
||||
vim.keymap.set('n', '<leader>fg', builtin.live_grep, { desc = 'Telescope live grep' })
|
||||
vim.keymap.set('n', '<leader>fb', builtin.buffers, { desc = 'Telescope buffers' })
|
||||
vim.keymap.set('n', '<leader>fh', builtin.help_tags, { desc = 'Telescope help tags' })
|
||||
Loading…
Add table
Add a link
Reference in a new issue