Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function map(mode, lhs, rhs, opts)
- local options = { noremap = true, silent = false }
- if opts then
- options = vim.tbl_extend("force", options, opts)
- end
- vim.api.nvim_set_keymap(mode, lhs, rhs, options)
- end
- vim.g.mapleader = " "
- local fn = vim.fn
- local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim'
- if fn.empty(fn.glob(install_path)) > 0 then
- packer_bootstrap = fn.system({ 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim',
- install_path })
- vim.cmd [[packadd packer.nvim]]
- end
- require('packer').startup(function(use)
- use { "wbthomason/packer.nvim" }
- use 'machakann/vim-highlightedyank'
- use 'aklt/plantuml-syntax'
- use 'tpope/vim-repeat'
- use 'tpope/vim-surround'
- use 'habamax/vim-asciidoctor'
- use 'dag/vim-fish'
- use 'dstein64/vim-startuptime'
- use 'lordm/vim-browser-reload-linux'
- use 'stevearc/dressing.nvim'
- use {
- 'RRethy/vim-hexokinase',
- run = 'make hexokinase',
- }
- use 'numToStr/Comment.nvim'
- require('Comment').setup({})
- local opt = { expr = true, remap = true, replace_keycodes = false }
- vim.keymap.set('n', '<leader>c',
- "v:count == 0 ? '<Plug>(comment_toggle_linewise_current)' : '<Plug>(comment_toggle_linewise_count)'", opt)
- vim.keymap.set('x', '<leader>c', '<Plug>(comment_toggle_linewise_visual)')
- use 'ethanholz/nvim-lastplace'
- require 'nvim-lastplace'.setup {
- lastplace_ignore_buftype = { "quickfix", "nofile", "help" },
- lastplace_ignore_filetype = { "gitcommit", "gitrebase", "svn", "hgcommit" },
- lastplace_open_folds = true
- }
- use 'Mofiqul/dracula.nvim'
- -- vim.opt.colorscheme = "dracula"
- vim.cmd[[colorscheme dracula]]
- use 'neovim/nvim-lspconfig'
- require 'lspconfig'.vimls.setup {}
- require 'lspconfig'.yamlls.setup {}
- require 'lspconfig'.bashls.setup {}
- require 'lspconfig'.dockerls.setup {}
- require 'lspconfig'.eslint.setup {}
- require 'lspconfig'.stylelint_lsp.setup {}
- require 'lspconfig'.cmake.setup {}
- require 'lspconfig'.clangd.setup {}
- require 'lspconfig'.zk.setup {}
- require 'lspconfig'.pylsp.setup {}
- require 'lspconfig'.sumneko_lua.setup {}
- require 'lspconfig'.taplo.setup {}
- -- require 'lspconfig'.jsonnet_ls.setup {}
- --
- local capabilities = vim.lsp.protocol.make_client_capabilities()
- capabilities.textDocument.completion.completionItem.snippetSupport = true
- require 'lspconfig'.jsonls.setup {
- capabilities = capabilities,
- }
- map("n", "<leader>d", ":lua vim.lsp.buf.definition()<CR>");
- map("n", "<leader>a", ":lua vim.lsp.buf.code_action()<CR>");
- map("n", "<leader>i", ":lua vim.lsp.buf.implementation()<CR>");
- -- map("n", "<leader>c", ":lua vim.lsp.buf.incoming_calls()<CR>");
- map("n", "<leader>f", ":lua vim.lsp.buf.formatting_seq_sync()<CR>");
- map("n", "<leader>h", ":lua vim.lsp.buf.hover()<CR>");
- map("n", "<leader>r", ":lua vim.lsp.buf.rename()<CR>");
- map("v", "<leader>r", ":lua vim.lsp.buf.range_code_action()<CR>");
- vim.api.nvim_create_autocmd({ "CursorHold", "InsertLeave" },
- { pattern = "*.*", command = ":lua vim.lsp.codelens.refresh()" })
- vim.api.nvim_create_autocmd("BufWritePre", { pattern = "*.*", command = ":lua vim.lsp.buf.formatting_sync()" })
- use 'yamatsum/nvim-cursorline'
- require('nvim-cursorline').setup {
- cursorline = {
- enable = true,
- timeout = 1000,
- number = false,
- },
- cursorword = {
- enable = true,
- min_length = 3,
- hl = { underline = true },
- }
- }
- use 'lnl7/vim-nix'
- require 'lspconfig'.rnix.setup {}
- use "lukas-reineke/indent-blankline.nvim"
- require("indent_blankline").setup {
- space_char_blankline = " ",
- show_current_context = true,
- show_current_context_start = true,
- -- indent_blankline_filetype_exclude = ["org"],
- }
- vim.cmd("let g:indent_blankline_filetype_exclude = ['org']")
- -- use "tpope/vim-sleuth"
- use 'lewis6991/gitsigns.nvim'
- require('gitsigns').setup()
- use {
- "folke/trouble.nvim",
- requires = "kyazdani42/nvim-web-devicons",
- config = function()
- require("trouble").setup {}
- end
- }
- use { 'nvim-lualine/lualine.nvim',
- requires = { 'kyazdani42/nvim-web-devicons', opt = true } }
- require 'nvim-web-devicons'.setup {
- default = true;
- }
- require('lualine').setup {
- options = {
- theme = 'dracula'
- }
- }
- use 'derekwyatt/vim-fswitch'
- map("n", "<Leader>s", ":FSHere<CR>")
- use 'hrsh7th/nvim-cmp'
- use 'hrsh7th/cmp-nvim-lsp'
- use 'f3fora/cmp-spell'
- use 'hrsh7th/cmp-buffer'
- use 'hrsh7th/cmp-path'
- use 'hrsh7th/cmp-cmdline'
- use 'hrsh7th/cmp-git'
- use 'hrsh7th/cmp-vsnip'
- use 'hrsh7th/vim-vsnip'
- use 'hrsh7th/vim-vsnip-integ'
- use 'rafamadriz/friendly-snippets'
- vim.opt.completeopt = { "menu", "menuone", "noselect" }
- local cmp = require 'cmp'
- cmp.setup({
- snippet = {
- -- REQUIRED - you must specify a snippet engine
- expand = function(args)
- vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
- -- require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
- -- require('snippy').expand_snippet(args.body) -- For `snippy` users.
- -- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
- end,
- },
- window = {
- -- completion = cmp.config.window.bordered(),
- -- documentation = cmp.config.window.bordered(),
- },
- mapping = cmp.mapping.preset.insert({
- ['<C-b>'] = cmp.mapping.scroll_docs(-4),
- ['<C-f>'] = cmp.mapping.scroll_docs(4),
- ['<C-Space>'] = cmp.mapping.complete(),
- ['<C-e>'] = cmp.mapping.abort(),
- ['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
- }),
- sources = cmp.config.sources({
- { name = 'nvim_lsp' },
- { name = 'orgmode' },
- { name = 'spell' },
- { name = 'vsnip' }, -- For vsnip users.
- -- { name = 'luasnip' }, -- For luasnip users.
- -- { name = 'ultisnips' }, -- For ultisnips users.
- -- { name = 'snippy' }, -- For snippy users.
- }, {
- { name = 'buffer' },
- })
- })
- -- Set configuration for specific filetype.
- cmp.setup.filetype('gitcommit', {
- sources = cmp.config.sources({
- { name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it.
- }, {
- { name = 'buffer' },
- })
- })
- -- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
- cmp.setup.cmdline('/', {
- mapping = cmp.mapping.preset.cmdline(),
- sources = {
- { name = 'buffer' }
- }
- })
- -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
- cmp.setup.cmdline(':', {
- mapping = cmp.mapping.preset.cmdline(),
- sources = cmp.config.sources({
- { name = 'path' }
- }, {
- { name = 'cmdline' }
- })
- })
- -- Setup lspconfig.
- local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
- -- Replace <YOUR_LSP_SERVER> with each lsp server you've enabled.
- require('lspconfig')['rnix'].setup {
- capabilities = capabilities
- }
- require('lspconfig')['vimls'].setup {
- capabilities = capabilities
- }
- require('lspconfig')['rust_analyzer'].setup {
- capabilities = capabilities
- }
- require('lspconfig')['bashls'].setup {
- capabilities = capabilities
- }
- require('lspconfig')['dockerls'].setup {
- capabilities = capabilities
- }
- require('lspconfig')['eslint'].setup {
- capabilities = capabilities
- }
- require('lspconfig')['stylelint_lsp'].setup {
- capabilities = capabilities
- }
- require('lspconfig')['cmake'].setup {
- capabilities = capabilities
- }
- require('lspconfig')['clangd'].setup {
- capabilities = capabilities
- }
- require('lspconfig')['zk'].setup {
- capabilities = capabilities
- }
- require('lspconfig')['pylsp'].setup {
- capabilities = capabilities
- }
- require('lspconfig')['sumneko_lua'].setup {
- capabilities = capabilities
- }
- require'lspconfig'.hls.setup{}
- use 'rust-lang/rust.vim'
- use 'simrat39/rust-tools.nvim'
- require 'lspconfig'.rust_analyzer.setup {}
- require 'rust-tools'.setup()
- use 'nvim-telescope/telescope.nvim'
- use 'nvim-lua/plenary.nvim'
- use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make' }
- require('telescope').load_extension('fzf')
- use {
- 'nvim-treesitter/nvim-treesitter',
- run = ':TSUpdate',
- }
- require 'nvim-treesitter.configs'.setup {
- ensure_installed = {
- "all"
- },
- auto_install = true,
- highlight = {
- enable = true,
- additional_vim_regex_highlighting = { 'org' },
- },
- ensure_installed = { 'org' },
- }
- use 'nvim-orgmode/orgmode'
- -- use {
- -- 'lukas-reineke/headlines.nvim',
- -- config = function()
- -- require('headlines').setup()
- -- end,
- -- }
- use 'dhruvasagar/vim-table-mode'
- use {
- 'michaelb/sniprun',
- run = 'bash install.sh',
- }
- use 'rcarriga/nvim-notify'
- require('orgmode').setup_ts_grammar()
- require('orgmode').setup({
- -- org_agenda_files = { '~/Dropbox/org/*', '~/my-orgs/**/*' },
- -- org_default_notes_file = '~/Dropbox/org/refile.org',
- })
- -- for i = 1, 40, 1 do
- -- vim.cmd(string.format("highlight OrgHeadlineLevel%d guibg=NONE", i))
- -- end
- use {
- 'akinsho/org-bullets.nvim', config = function()
- require('org-bullets').setup()
- end
- }
- vim.opt.conceallevel = 2
- vim.opt.concealcursor = 'nc'
- vim.api.nvim_create_autocmd("BufWritePost", { pattern = "*.org", command = "!~/tangle.py %" })
- vim.api.nvim_create_autocmd("BufWritePost",
- { pattern = "configuration.org", command = "!sudo cp ~/configuration.nix /etc/nixos/configuration.nix" })
- vim.api.nvim_create_autocmd("BufWritePost",
- { pattern = "configuration.org",
- command = "!cp ~/configuration.nix ~/repos/dotfiles/ && cd ~/repos/dotfiles/ && git add . && git commit -m \"Automatic configuration.nix back up\" && git push" })
- vim.api.nvim_create_autocmd("BufWritePost",
- { pattern = "configuration.org",
- command = "!cp ~/configuration.org ~/repos/dotfiles/ && cd ~/repos/dotfiles/ && git add . && git commit -m \"Automatic configuration.nix back up\" && git push" })
- use { 'kamykn/spelunker.vim' }
- use { 'kamykn/popup-menu.nvim' }
- use {
- 'kyazdani42/nvim-tree.lua',
- requires = {
- 'kyazdani42/nvim-web-devicons'
- }
- }
- require 'nvim-web-devicons'.setup {
- default = true;
- }
- require("nvim-tree").setup({
- git = {
- ignore = false,
- },
- actions = {
- open_file = {
- resize_window = true
- }
- }
- })
- vim.o.splitright = true;
- -- use 'nvim-treesitter/nvim-treesitter-textobjects'
- use 'jeffkreeftmeijer/vim-numbertoggle'
- map("n", ",t", "i#[test]<CR>fn () {<CR>}<ESC>kwi")
- map("n", ",tm", "i#[cfg(test)]<CR>mod tests {<CR>use super::*;<CR><CR>#[test]<CR>fn () {<CR>}<CR><ESC>xxxxi}<ESC>kkwwi")
- map("n", "<Up>", "<Nop>")
- map("n", "<Down>", "<Nop>")
- map("n", "<Left>", "<Nop>")
- map("n", "<Right>", "<Nop>")
- map("i", "<Up>", "<Nop>")
- map("i", "<Down>", "<Nop>")
- map("i", "<Left>", "<Nop>")
- map("i", "<Right>", "<Nop>")
- map("v", "<Up>", "<Nop>")
- map("v", "<Down>", "<Nop>")
- map("v", "<Left>", "<Nop>")
- map("v", "<Right>", "<Nop>")
- map("n", "j", "gj")
- map("n", "k", "gk")
- map("n", "<leader><space>", ":noh<cr>")
- map("n", ":", ";")
- map("n", ";", ":")
- map("n", "<C-s>", ":wa<CR>")
- map("n", "<Enter>", "o<ESC>")
- map("n", "<S-Enter>", "O<ESC>")
- vim.api.nvim_create_autocmd("FocusLost", { pattern = "*.*", command = ":wa" })
- vim.o.autoread = true
- vim.api.nvim_create_autocmd({ "bufenter", "cursorhold", "cursorholdi", "focusgained" },
- { pattern = "*.*", command = "if mode() != 'c' | checktime | endif", })
- vim.api.nvim_create_autocmd("FileChangedShellPost",
- { pattern = "*.*", command = "echohl WarningMsg | echo \"File changed on disk. Buffer reloaded.\" | echohl None", })
- vim.o.cursorline = true
- vim.o.mouse = "a"
- vim.o.undofile = true
- vim.o.undodir = "~/.config/nvim"
- vim.cmd [[set noswapfile]]
- -- vim.opt.noswapfile = true
- vim.o.foldmethod = "marker"
- vim.o.hlsearch = true
- vim.o.ignorecase = true
- vim.o.smartcase = true
- vim.o.incsearch = true
- vim.o.showmatch = true
- vim.o.gdefault = true
- vim.o.termguicolors = true
- vim.o.clipboard = "unnamedplus"
- vim.o.tabstop = 4
- vim.o.shiftwidth = 4
- vim.o.expandtab = true
- vim.o.number = true
- vim.o.relativenumber = true
- vim.o.hidden = true
- vim.opt.spell = true
- vim.opt.spelllang = { 'en_us' }
- vim.o.spellcapcheck = "="
- vim.o.spellsuggest = "10"
- vim.opt.spelloptions = "camel"
- vim.o.confirm = true
- vim.o.wrap = false
- vim.opt.path = vim.opt.path + "**"
- vim.opt.wildmenu = true
- vim.api.nvim_create_autocmd("BufWritePost",
- { pattern = "init.lua", command = "so $MYVIMRC | if has('gui_running') | so $MYGVIMRC | endif", })
- vim.cmd [[
- if &shell =~# 'fish$'
- set shell=bash
- endif
- ]]
- -- autocmd QuickFixCmdPost [^l]* nested cwindow
- -- autocmd QuickFixCmdPost l* nested lwindow
- vim.api.nvim_create_autocmd("QuickFixCmdPost", { pattern = "[^l]*", command = "cwindow", })
- vim.api.nvim_create_autocmd("QuickFixCmdPost", { pattern = "l*", command = "lwindow", })
- -- au FileType qf call AdjustWindowHeight(3, 10)
- -- function! AdjustWindowHeight(minheight, maxheight)
- -- exe max([min([line("$"), a:maxheight]), a:minheight]) . "wincmd _"
- -- endfunction "
- vim.cmd([[
- au FileType qf call AdjustWindowHeight(3, 10)
- function! AdjustWindowHeight(minheight, maxheight)
- exe max([min([line("$"), a:maxheight]), a:minheight]) . "wincmd _"
- endfunction "
- ]])
- local packer_group = vim.api.nvim_create_augroup('Packer', { clear = true })
- vim.api.nvim_create_autocmd('BufWritePost', {
- command = 'source <afile> | PackerCompile',
- group = packer_group,
- pattern = vim.fn.expand '$MYVIMRC',
- })
- vim.api.nvim_create_autocmd("VimEnter",
- { pattern = "*/home/refaelsh/repos/*", command = "so .nvimrc", })
- if packer_bootstrap then
- require('packer').sync()
- end
- end)
- if packer_bootstrap then
- print '=================================='
- print ' Plugins are being installed'
- print ' Wait until Packer completes,'
- print ' then restart nvim'
- print '=================================='
- return
- end
Advertisement
Add Comment
Please, Sign In to add comment