configuration.nix/home/nvim.nix

165 lines
3.9 KiB
Nix
Raw Normal View History

2023-03-29 21:48:55 +05:30
{ pkgs, ... }: {
2023-03-22 23:27:24 +05:30
xdg.desktopEntries."nvim".name = "Neovim wrapper";
xdg.desktopEntries."nvim".exec = "nvim %F";
xdg.desktopEntries."nvim".noDisplay = true;
2023-03-15 22:11:59 +05:30
programs.neovim = {
enable = true;
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
withNodeJs = true;
withPython3 = true;
withRuby = true;
extraLuaConfig = ''
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
'';
extraPackages = with pkgs; [
fd
ripgrep
rnix-lsp
tree-sitter
];
plugins = with pkgs.vimPlugins; [
dracula-nvim
2023-03-29 21:48:55 +05:30
(nvim-treesitter.withPlugins (plugins: with plugins; [ bash dockerfile gitcommit gitignore git_rebase go markdown markdown_inline nix rust toml yaml ]))
2023-03-15 22:11:59 +05:30
nvim-treesitter-context
nvim-treesitter-refactor
telescope-nvim
vim-fugitive
vim-go
vim-nix
rust-vim
{
plugin = bufferline-nvim;
type = "lua";
config = ''
require("bufferline").setup{
options = {
offsets = {
{
2023-03-22 23:28:48 +05:30
filetype = "NvimTree",
2023-03-15 22:11:59 +05:30
separator = true
}
},
diagnostics = "nvim_lsp",
separator_style = "slant",
truncate_names = true
}
}
'';
}
{
plugin = git-blame-nvim;
config = ''
let g:gitblame_date_format = '%r'
let g:gitblame_message_when_not_committed = '''
'';
}
{
plugin = gitsigns-nvim;
type = "lua";
config = ''
require('gitsigns').setup()
'';
}
2023-03-17 22:44:19 +05:30
{
plugin = indent-blankline-nvim;
type = "lua";
config = ''
vim.opt.list = true
vim.opt.listchars:append "space:"
vim.opt.listchars:append "eol:"
require("indent_blankline").setup {
show_end_of_line = true
}
'';
}
2023-03-15 22:11:59 +05:30
{
plugin = lualine-nvim;
type = "lua";
config = ''
require('lualine').setup {
options = {
icons_enabled = true,
theme = 'dracula',
globalstatus = true
}
}
'';
}
{
plugin = nvim-lastplace;
type = "lua";
config = ''
require('nvim-lastplace').setup{}
'';
}
{
plugin = nvim-lspconfig;
type = "lua";
config = ''
require('lspconfig').gopls.setup{}
require('lspconfig').rnix.setup{}
require('lspconfig').rust_analyzer.setup{}
'';
}
2023-03-21 21:27:55 +05:30
{
plugin = nvim-tree-lua;
type = "lua";
config = ''
require('nvim-tree').setup{}
'';
}
2023-03-15 22:11:59 +05:30
{
plugin = nvim-web-devicons;
type = "lua";
config = ''
require('nvim-web-devicons').setup {
2023-03-21 01:03:32 +05:30
default = true
2023-03-15 22:11:59 +05:30
}
'';
}
{
plugin = toggleterm-nvim;
type = "lua";
config = ''
require('toggleterm').setup{}
'';
}
];
extraConfig = ''
set autowrite
set background=dark
set clipboard+=unnamedplus
set expandtab
set laststatus=2
set list
set noshowmode
set noswapfile
set number
set relativenumber
set shiftwidth=2
set signcolumn=yes
set smartindent
set tabstop=2
set termguicolors
set updatetime=100
set wrap
colorscheme dracula
2023-03-22 23:28:48 +05:30
nmap <C-a> :bp<Return>
nmap <C-d> :bn<Return>
2023-03-15 22:11:59 +05:30
nnoremap <C-h> :noh<Return>
nnoremap <leader>` :ToggleTerm<Return>
2023-03-22 23:28:48 +05:30
nnoremap <leader>1 :NvimTreeToggle<Return>
2023-03-15 22:11:59 +05:30
nnoremap <leader>ff <cmd>Telescope find_files<cr>
nnoremap <leader>fg <cmd>Telescope live_grep<cr>
nnoremap <leader>fb <cmd>Telescope buffers<cr>
nnoremap <leader>fh <cmd>Telescope help_tags<cr>
'';
};
}