Remove easyalign, nerdtree and other unused plugins. Reordered vim plugins, added leap
This commit is contained in:
parent
bb5bf44156
commit
71f8e1e11e
@ -3,18 +3,20 @@
|
|||||||
{
|
{
|
||||||
imports = [ ./zsh.nix ./git.nix ];
|
imports = [ ./zsh.nix ./git.nix ];
|
||||||
|
|
||||||
|
|
||||||
home = {
|
home = {
|
||||||
stateVersion = "21.05";
|
stateVersion = "21.05";
|
||||||
sessionVariables = {
|
sessionVariables = {
|
||||||
EDITOR = "nvim";
|
EDITOR = "nvim";
|
||||||
VISUAL = "nvim";
|
VISUAL = "nvim";
|
||||||
};
|
};
|
||||||
|
|
||||||
packages = with pkgs; [ rizin sshfs nixfmt victor-mono ];
|
packages = with pkgs; [ rizin sshfs nixfmt victor-mono ];
|
||||||
};
|
};
|
||||||
|
|
||||||
programs.neovim = {
|
programs.neovim = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
viAlias = true;
|
||||||
|
vimAlias = true;
|
||||||
extraPackages = with pkgs; [
|
extraPackages = with pkgs; [
|
||||||
nodePackages.prettier
|
nodePackages.prettier
|
||||||
nodePackages.pyright
|
nodePackages.pyright
|
||||||
@ -24,6 +26,26 @@
|
|||||||
clang-tools
|
clang-tools
|
||||||
rustfmt
|
rustfmt
|
||||||
];
|
];
|
||||||
|
plugins = with pkgs.vimPlugins; [
|
||||||
|
vim-nix
|
||||||
|
molokai
|
||||||
|
vim-airline
|
||||||
|
vim-airline-themes
|
||||||
|
vim-lsp
|
||||||
|
vim-indent-guides
|
||||||
|
vim-signify
|
||||||
|
vim-fugitive
|
||||||
|
vimtex
|
||||||
|
neoformat
|
||||||
|
nvim-lspconfig
|
||||||
|
vim-vsnip
|
||||||
|
nvim-cmp
|
||||||
|
cmp-nvim-lsp
|
||||||
|
(nvim-treesitter.withPlugins (_: pkgs.tree-sitter.allGrammars))
|
||||||
|
nvim-treesitter-textobjects
|
||||||
|
pkgs.vimExtraPlugins.leap-nvim
|
||||||
|
];
|
||||||
|
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
" syntax
|
" syntax
|
||||||
syntax enable
|
syntax enable
|
||||||
@ -36,38 +58,16 @@
|
|||||||
set wildmode=longest:full,full
|
set wildmode=longest:full,full
|
||||||
|
|
||||||
" remapping popup menu (command autocompletion)
|
" remapping popup menu (command autocompletion)
|
||||||
" cnoremap <expr> <up> pumvisible() ? "<C-p>" : "<up>
|
cnoremap <expr> <up> pumvisible() ? "<C-p>" : "<up>
|
||||||
" cnoremap <expr> <down> pumvisible() ? "<C-n>" : "<down>"
|
cnoremap <expr> <down> pumvisible() ? "<C-n>" : "<down>"
|
||||||
" cnoremap <expr> <CR> pumvisible() ? "<C-e>":"<CR>"
|
cnoremap <expr> <CR> pumvisible() ? "<C-e>":"<CR>"
|
||||||
|
|
||||||
" set line numbers
|
" set line numbers
|
||||||
set number
|
set number
|
||||||
|
|
||||||
" enable indent guides
|
" enable indent guides
|
||||||
let g:indent_guides_enable_on_vim_startup = 1
|
let g:indent_guides_enable_on_vim_startup = 1
|
||||||
|
|
||||||
" Exit Vim if NERDTree is the only window left.
|
|
||||||
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() |
|
|
||||||
\ quit | endif
|
|
||||||
|
|
||||||
" Start NERDTree. If a file is specified, move the cursor to its window.
|
|
||||||
autocmd StdinReadPre * let s:std_in=1
|
|
||||||
autocmd VimEnter * NERDTree | if argc() > 0 || exists("s:std_in") | wincmd p | endif
|
|
||||||
|
|
||||||
" Start NERDTree when Vim starts with a directory argument.
|
|
||||||
autocmd StdinReadPre * let s:std_in=1
|
|
||||||
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists('s:std_in') |
|
|
||||||
\ execute 'NERDTree' argv()[0] | wincmd p | enew | execute 'cd '.argv()[0] | endif
|
|
||||||
|
|
||||||
" Exit Vim if NERDTree is the only window left.
|
|
||||||
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() |
|
|
||||||
\ quit | endif
|
|
||||||
|
|
||||||
" Start interactive EasyAlign in visual mode (e.g. vipga)
|
|
||||||
xmap ga <Plug>(EasyAlign)
|
|
||||||
|
|
||||||
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
|
|
||||||
nmap ga <Plug>(EasyAlign)
|
|
||||||
|
|
||||||
" Highlight row and column
|
" Highlight row and column
|
||||||
set cul
|
set cul
|
||||||
set cuc
|
set cuc
|
||||||
@ -86,123 +86,105 @@
|
|||||||
let g:neoformat_basic_format_trim = 1
|
let g:neoformat_basic_format_trim = 1
|
||||||
|
|
||||||
lua << EOF
|
lua << EOF
|
||||||
------------------
|
|
||||||
-- Setup nvim-cmp.
|
|
||||||
------------------
|
|
||||||
|
|
||||||
-- Set completeopt to have a better completion experience
|
-- Setup leap-nvim keymappings
|
||||||
vim.o.completeopt = 'menuone,noselect'
|
require('leap').add_default_mappings()
|
||||||
|
|
||||||
local cmp = require'cmp'
|
------------------
|
||||||
|
-- Setup nvim-cmp.
|
||||||
|
------------------
|
||||||
|
|
||||||
cmp.setup({
|
-- Set completeopt to have a better completion experience
|
||||||
snippet = {
|
vim.o.completeopt = 'menuone,noselect'
|
||||||
-- REQUIRED - you must specify a snippet engine
|
|
||||||
expand = function(args)
|
local cmp = require'cmp'
|
||||||
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
|
|
||||||
end,
|
cmp.setup({
|
||||||
},
|
snippet = {
|
||||||
mapping = {
|
-- REQUIRED - you must specify a snippet engine
|
||||||
['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
|
expand = function(args)
|
||||||
['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
|
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
|
||||||
['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
|
end,
|
||||||
['<C-y>'] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
|
},
|
||||||
['<C-e>'] = cmp.mapping({
|
mapping = {
|
||||||
i = cmp.mapping.abort(),
|
['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
|
||||||
c = cmp.mapping.close(),
|
['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
|
||||||
}),
|
['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
|
||||||
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
['<C-y>'] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
|
||||||
},
|
['<C-e>'] = cmp.mapping({
|
||||||
sources = cmp.config.sources({
|
i = cmp.mapping.abort(),
|
||||||
{ name = 'nvim_lsp' },
|
c = cmp.mapping.close(),
|
||||||
{ name = 'vsnip' }, -- For vsnip users.
|
}),
|
||||||
}, {
|
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||||
{ name = 'buffer' },
|
},
|
||||||
})
|
sources = cmp.config.sources({
|
||||||
|
{ name = 'nvim_lsp' },
|
||||||
|
{ name = 'vsnip' }, -- For vsnip users.
|
||||||
|
}, {
|
||||||
|
{ name = 'buffer' },
|
||||||
})
|
})
|
||||||
|
})
|
||||||
|
|
||||||
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
|
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
|
||||||
cmp.setup.cmdline('/', {
|
cmp.setup.cmdline('/', {
|
||||||
sources = {
|
sources = {
|
||||||
{ name = 'buffer' }
|
{ name = 'buffer' }
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||||
|
cmp.setup.cmdline(':', {
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = 'path' }
|
||||||
|
}, {
|
||||||
|
{ name = 'cmdline' }
|
||||||
})
|
})
|
||||||
|
})
|
||||||
|
|
||||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
-- Setup lspconfig.
|
||||||
cmp.setup.cmdline(':', {
|
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||||
sources = cmp.config.sources({
|
|
||||||
{ name = 'path' }
|
|
||||||
}, {
|
|
||||||
{ name = 'cmdline' }
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Setup lspconfig.
|
--------------
|
||||||
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
-- LSP Servers
|
||||||
|
--------------
|
||||||
|
|
||||||
--------------
|
require'lspconfig'.pyright.setup{
|
||||||
-- LSP Servers
|
capabilities = capabilities
|
||||||
--------------
|
}
|
||||||
|
require'lspconfig'.rust_analyzer.setup{
|
||||||
|
capabilities = capabilities
|
||||||
|
}
|
||||||
|
require'lspconfig'.rnix.setup{
|
||||||
|
capabilities = capabilities
|
||||||
|
}
|
||||||
|
require'lspconfig'.clangd.setup{
|
||||||
|
capabilities = capabilities,
|
||||||
|
cmd = {
|
||||||
|
"clangd",
|
||||||
|
"--background-index",
|
||||||
|
"--clang-tidy",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
require'lspconfig'.pyright.setup{
|
-------------------
|
||||||
capabilities = capabilities
|
-- TreeSitter setup
|
||||||
}
|
-------------------
|
||||||
require'lspconfig'.rust_analyzer.setup{
|
require'nvim-treesitter.configs'.setup {
|
||||||
capabilities = capabilities
|
highlight = {
|
||||||
}
|
enable = true,
|
||||||
require'lspconfig'.rnix.setup{
|
custom_captures = {
|
||||||
capabilities = capabilities
|
-- Highlight the @foo.bar capture group with the "Identifier" highlight group.
|
||||||
}
|
["foo.bar"] = "Identifier",
|
||||||
require'lspconfig'.clangd.setup{
|
|
||||||
capabilities = capabilities,
|
|
||||||
cmd = {
|
|
||||||
"clangd",
|
|
||||||
"--background-index",
|
|
||||||
"--clang-tidy",
|
|
||||||
},
|
},
|
||||||
}
|
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
|
||||||
|
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
|
||||||
-------------------
|
-- Using this option may slow down your editor, and you may see some duplicate highlights.
|
||||||
-- TreeSitter setup
|
-- Instead of true it can also be a list of languages
|
||||||
-------------------
|
additional_vim_regex_highlighting = false,
|
||||||
require'nvim-treesitter.configs'.setup {
|
},
|
||||||
highlight = {
|
}
|
||||||
enable = true,
|
|
||||||
custom_captures = {
|
|
||||||
-- Highlight the @foo.bar capture group with the "Identifier" highlight group.
|
|
||||||
["foo.bar"] = "Identifier",
|
|
||||||
},
|
|
||||||
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
|
|
||||||
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
|
|
||||||
-- Using this option may slow down your editor, and you may see some duplicate highlights.
|
|
||||||
-- Instead of true it can also be a list of languages
|
|
||||||
additional_vim_regex_highlighting = false,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
EOF
|
EOF
|
||||||
'';
|
'';
|
||||||
|
|
||||||
viAlias = true;
|
|
||||||
vimAlias = true;
|
|
||||||
plugins = with pkgs.vimPlugins; [
|
|
||||||
vim-nix
|
|
||||||
molokai
|
|
||||||
vim-airline
|
|
||||||
vim-airline-themes
|
|
||||||
vim-lsp
|
|
||||||
vim-indent-guides
|
|
||||||
vim-signify
|
|
||||||
nerdtree
|
|
||||||
vim-easy-align
|
|
||||||
vim-fugitive
|
|
||||||
vimtex
|
|
||||||
neoformat
|
|
||||||
nvim-lspconfig
|
|
||||||
vim-vsnip
|
|
||||||
nvim-cmp
|
|
||||||
cmp-nvim-lsp
|
|
||||||
(nvim-treesitter.withPlugins (_: pkgs.tree-sitter.allGrammars))
|
|
||||||
nvim-treesitter-textobjects
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user