2024-04-02 20:52:48 +02:00
|
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
# neovim
|
|
|
|
|
programs.neovim = {
|
|
|
|
|
enable = true;
|
|
|
|
|
defaultEditor = true;
|
|
|
|
|
viAlias = true;
|
|
|
|
|
vimAlias = true;
|
|
|
|
|
|
|
|
|
|
# neovim config
|
|
|
|
|
extraConfig = ''
|
|
|
|
|
|
|
|
|
|
" Use tab for trigger completion with characters ahead and navigate.
|
|
|
|
|
inoremap <silent><expr> <TAB>
|
|
|
|
|
\ pumvisible() ? "\<C-n>" :
|
|
|
|
|
\ <SID>check_back_space() ? "\<TAB>" :
|
|
|
|
|
\ coc#refresh()
|
|
|
|
|
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
|
|
|
|
|
function! s:check_back_space() abort
|
|
|
|
|
let col = col('.') - 1
|
|
|
|
|
return !col || getline('.')[col - 1] =~# '\s'
|
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
" Use <c-space> to trigger completion.
|
|
|
|
|
if has('nvim')
|
|
|
|
|
inoremap <silent><expr> <c-space> coc#refresh()
|
|
|
|
|
else
|
|
|
|
|
inoremap <silent><expr> <c-@> coc#refresh()
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
" clipboard
|
|
|
|
|
set clipboard+=unnamedplus
|
|
|
|
|
|
|
|
|
|
" terminal title
|
|
|
|
|
set title
|
|
|
|
|
|
|
|
|
|
" auto-complete
|
|
|
|
|
set completeopt=menu,menuone,longest
|
|
|
|
|
|
|
|
|
|
" show number
|
|
|
|
|
set number
|
2024-04-03 23:10:18 +02:00
|
|
|
|
|
|
|
|
|
" set no wrap
|
|
|
|
|
set nowrap
|
2024-04-02 20:52:48 +02:00
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
# lua config
|
|
|
|
|
extraLuaConfig = ''
|
|
|
|
|
|
|
|
|
|
-- set mapleader
|
|
|
|
|
vim.g.mapleader = ' '
|
|
|
|
|
vim.g.maplocalleader = ' '
|
|
|
|
|
|
|
|
|
|
-- set vim options
|
|
|
|
|
vim.opt.backspace = '2'
|
|
|
|
|
vim.opt.laststatus = 2
|
|
|
|
|
vim.opt.cursorline = true
|
2024-04-03 17:50:29 +02:00
|
|
|
|
vim.opt.guicursor= { 'a:hor20-Cursor/lCursor' }
|
2024-04-02 20:52:48 +02:00
|
|
|
|
|
|
|
|
|
-- set scrolloff
|
|
|
|
|
vim.opt.scrolloff = 10
|
|
|
|
|
|
|
|
|
|
-- indentation
|
|
|
|
|
vim.opt.tabstop = 2
|
|
|
|
|
vim.opt.shiftwidth = 2
|
|
|
|
|
vim.opt.expandtab = true
|
|
|
|
|
vim.opt.smartindent = true
|
2024-04-02 21:26:08 +02:00
|
|
|
|
|
2024-04-03 17:41:07 +02:00
|
|
|
|
-- vim leave function
|
|
|
|
|
vim.api.nvim_create_autocmd({ "VimLeave" }, {
|
2024-04-03 17:50:29 +02:00
|
|
|
|
callback = function()
|
|
|
|
|
vim.cmd('set guicursor=a:hor20-Cursor/lCursor')
|
|
|
|
|
end,
|
2024-04-03 17:41:07 +02:00
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
2024-04-02 21:26:08 +02:00
|
|
|
|
-- load plugins
|
2024-04-07 00:20:53 +02:00
|
|
|
|
require("gitsigns").setup()
|
|
|
|
|
vim.keymap.set("n", "<leader>gp", ":Gitsigns preview_hunk<CR>", {})
|
|
|
|
|
vim.keymap.set("n", "<leader>gb", ":Gitsigns toggle_current_line_blame<CR>", {})
|
|
|
|
|
|
2024-04-02 23:08:02 +02:00
|
|
|
|
-- neo-tree
|
2024-04-02 21:26:08 +02:00
|
|
|
|
require("neo-tree").setup({
|
2024-04-02 22:33:04 +02:00
|
|
|
|
filesystem = {
|
|
|
|
|
filtered_items = {
|
2024-04-02 23:20:05 +02:00
|
|
|
|
visible = true,
|
2024-04-02 22:33:04 +02:00
|
|
|
|
hide_dotfiles = false,
|
|
|
|
|
hide_gitignored = false,
|
|
|
|
|
},
|
|
|
|
|
},
|
2024-04-02 21:26:08 +02:00
|
|
|
|
window = {
|
|
|
|
|
position = "left",
|
2024-04-02 23:32:44 +02:00
|
|
|
|
width = 45,
|
2024-04-03 17:09:37 +02:00
|
|
|
|
mapping_options = {
|
|
|
|
|
noremap = true,
|
|
|
|
|
nowait = true,
|
|
|
|
|
},
|
|
|
|
|
mappings = {
|
|
|
|
|
["<space>"] = {
|
|
|
|
|
"toggle_node",
|
|
|
|
|
nowait = false,
|
|
|
|
|
},
|
|
|
|
|
},
|
2024-04-02 21:26:08 +02:00
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
require("neo-tree.sources.manager").show("filesystem")
|
|
|
|
|
|
2024-04-03 17:09:37 +02:00
|
|
|
|
|
2024-04-02 23:08:02 +02:00
|
|
|
|
-- nvim-treesitter
|
|
|
|
|
require("nvim-treesitter").setup({
|
|
|
|
|
build = ":TSUpdate",
|
|
|
|
|
config = function ()
|
|
|
|
|
local configs = require("nvim-treesitter.configs")
|
|
|
|
|
configs.setup({
|
|
|
|
|
ensure_installed = { "ansible", "css", "lua", "nix,", "yaml" },
|
|
|
|
|
sync_install = false,
|
|
|
|
|
highlight = { enable = true },
|
|
|
|
|
indent = { enable = true },
|
|
|
|
|
})
|
|
|
|
|
end
|
|
|
|
|
})
|
2024-04-03 16:41:51 +02:00
|
|
|
|
|
2024-04-03 17:09:37 +02:00
|
|
|
|
|
2024-04-03 16:41:51 +02:00
|
|
|
|
-- telescope-nvim
|
|
|
|
|
local builtin = require("telescope.builtin")
|
|
|
|
|
vim.keymap.set('n', '<C-p>', builtin.find_files, {})
|
|
|
|
|
|
2024-04-03 17:09:37 +02:00
|
|
|
|
|
2024-04-03 16:41:51 +02:00
|
|
|
|
-- vimplugin-catppuccin-nvim
|
2024-04-03 22:55:04 +02:00
|
|
|
|
require("catppuccin").setup({
|
|
|
|
|
flavour = "mocha",
|
|
|
|
|
transparent_background = "true"
|
|
|
|
|
})
|
2024-04-03 16:41:51 +02:00
|
|
|
|
vim.cmd.colorscheme "catppuccin"
|
2024-04-02 20:52:48 +02:00
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
# auto-complete
|
|
|
|
|
coc = {
|
|
|
|
|
enable = true;
|
|
|
|
|
settings = {
|
|
|
|
|
"suggest.noselect" = true;
|
|
|
|
|
"suggest.enablePreview" = true;
|
|
|
|
|
"suggest.enablePreselect" = true;
|
|
|
|
|
"suggest.disableKind" = true;
|
|
|
|
|
|
|
|
|
|
"diagnostic.errorSign" = "✘";
|
|
|
|
|
"diagnostic.infoSign" = "ℹ";
|
|
|
|
|
"diagnostic.hintSign" = "➤";
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
# plugins
|
|
|
|
|
plugins = with pkgs.vimPlugins; [
|
2024-04-07 00:20:53 +02:00
|
|
|
|
gitsigns-nvim
|
2024-04-02 21:26:08 +02:00
|
|
|
|
neo-tree-nvim
|
2024-04-02 23:08:02 +02:00
|
|
|
|
nvim-treesitter
|
2024-04-03 16:41:51 +02:00
|
|
|
|
telescope-nvim
|
|
|
|
|
catppuccin-nvim
|
2024-04-02 20:52:48 +02:00
|
|
|
|
];
|
|
|
|
|
};
|
|
|
|
|
}
|
2024-04-02 21:26:08 +02:00
|
|
|
|
|