{ pkgs, home, ... }: { home.sessionVariables = { EDITOR = "vim"; }; home.packages = with pkgs; [ nixfmt git ]; programs.neovim = { enable = true; viAlias = true; vimAlias = true; vimdiffAlias = true; coc.enable = true; withPython3 = true; plugins = with pkgs.vimPlugins; [ #theme dracula-vim # LSP nvim-lspconfig plenary-nvim #Telescope telescope-nvim nvim-web-devicons (nvim-treesitter.withPlugins (ps: with ps; [ tree-sitter-nix tree-sitter-python tree-sitter-svelte ])) bufferline-nvim galaxyline-nvim nvim-colorizer-lua pears-nvim # dusk-vim nvim-tree-lua vim-lastplace vim-nix lean-nvim vim-nixhash vim-yaml vim-toml vim-airline vim-devicons zig-vim vim-scriptease semshi coc-nvim coc-rust-analyzer rust-vim ]; extraPackages = with pkgs; [ rust-analyzer ]; extraConfig = '' syntax on " This has to be defined at the top of the file let maplocalleader = "\\" let mapleader = "\" colorscheme dracula set scrolloff=4 " noswapfile " nobackup " undodir=~/.vim/undodir " undofile " spell " Search case sensitivity set smartcase set ignorecase " No error bells set noerrorbells " GoTo code navigation. nmap gd (coc-definition) nmap gy (coc-type-definition) nmap gi (coc-implementation) nmap gr (coc-references) " Use K to show documentation in preview window. nnoremap K :call show_documentation() " Flex nnoremap gg0G$yG$r Go0"_Dp$pgg$p " Correct my typos command W :w command Wq :wq command WQ :wq " Move text arround vnoremap J :m '>+1gv=gv vnoremap K :m '<-2gv=gv inoremap :m .+1==i inoremap :m .-2==i nnoremap j :m .+1== nnoremap k :m .-2== " Completion set wildmenu set completeopt=longest,menuone " Completion in command bar set wmnu set wildmode=list:longest,list:full set wildignore=*.o " Command bar set history=2000 " Search set incsearch set nohlsearch " No mouse " set mouse= " Encoding set encoding=utf-8 set fileencoding=utf-8 " Make neovim more powerfull set nocompatible " Allow backspace in insert mode set backspace=indent,eol,start " Highlight the current line set cursorline hi CursorLine term=bold cterm=bold ctermbg=darkgrey " Line numbers set number set relativenumber " Tabs vs spaces set tabstop=2 set softtabstop=2 set shiftwidth=2 set expandtab " Auto indent set smartindent set autoindent " Ctrl-T for new tab nnoremap :tabnew " Delete tralling whitespace on save autocmd BufWritePre * %s/\s\+$//e " Spell-check map :setlocal spell! spelllang=en_us map :setlocal spell! spelllang=fr " Line and word count map :!wc % " Lean lua< buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') -- Mappings. local opts = { noremap=true, silent=true } -- See `:help vim.lsp.*` for documentation on any of the below functions buf_set_keymap('n', 'gD', 'lua vim.lsp.buf.declaration()', opts) buf_set_keymap('n', 'gd', 'lua vim.lsp.buf.definition()', opts) buf_set_keymap('n', 'K', 'lua vim.lsp.buf.hover()', opts) buf_set_keymap('n', 'gi', 'lua vim.lsp.buf.implementation()', opts) buf_set_keymap('n', '', 'lua vim.lsp.buf.signature_help()', opts) buf_set_keymap('n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opts) buf_set_keymap('n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()', opts) buf_set_keymap('n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opts) buf_set_keymap('n', 'D', 'lua vim.lsp.buf.type_definition()', opts) buf_set_keymap('n', 'rn', 'lua vim.lsp.buf.rename()', opts) buf_set_keymap('n', 'ca', 'lua vim.lsp.buf.code_action()', opts) buf_set_keymap('n', 'gr', 'lua vim.lsp.buf.references()', opts) buf_set_keymap('n', 'e', 'lua vim.lsp.diagnostic.show_line_diagnostics()', opts) buf_set_keymap('n', '[d', 'lua vim.lsp.diagnostic.goto_prev()', opts) buf_set_keymap('n', ']d', 'lua vim.lsp.diagnostic.goto_next()', opts) buf_set_keymap('n', 'q', 'lua vim.lsp.diagnostic.set_loclist()', opts) buf_set_keymap('n', 'f', 'lua vim.lsp.buf.formatting()', opts) end require("nvim-tree").setup() local builtin = require('telescope.builtin') vim.keymap.set('n', 'ff', builtin.find_files, {}) vim.keymap.set('n', 'fg', builtin.live_grep, {}) vim.keymap.set('n', 'fb', builtin.buffers, {}) vim.keymap.set('n', 'fh', builtin.help_tags, {}) require'nvim-web-devicons'.setup() EOF ''; }; }