|
| 1 | +require("global_settings") |
| 2 | + |
| 3 | +-- my theme: danger |
| 4 | +vim.opt.background = "dark" |
| 5 | +vim.cmd("colorscheme danger") |
| 6 | + |
| 7 | +vim.opt.encoding = "utf-8" |
| 8 | + |
| 9 | +-- tab settings |
| 10 | +vim.opt.tabstop = 4 |
| 11 | +vim.opt.shiftwidth = 4 |
| 12 | +vim.opt.softtabstop = 4 |
| 13 | +vim.opt.expandtab = true |
| 14 | + |
| 15 | +-- completion menu |
| 16 | +vim.opt.wildmenu = true |
| 17 | +vim.opt.wildmode = "list:longest,list:full" |
| 18 | +vim.opt.wildignore:append("*.o,*.obj,.git,*.rbc,*.class,.svn,vendor/gems/*,*.bak,*.exe,*.pyc,*.dll,*.pdb,*.DS_Store,*.db,env,*/debug/*,*/Debug/*,*/publish/*") |
| 19 | + |
| 20 | +vim.opt.undofile = true |
| 21 | + |
| 22 | +vim.opt.tags = "tags;$HOME/.config/nvim/tags/;$HOME/tmp/tags/" -- find ctags |
| 23 | +vim.opt.listchars = [[tab:▸\ ,eol:¬]] -- listchars for invisibles |
| 24 | +vim.opt.mouse = "a" -- fix mouse |
| 25 | +vim.opt.ls = 2 -- status line always show |
| 26 | +vim.opt.scrolloff = 5 -- show 5 lines before cursor always |
| 27 | +vim.opt.showcmd = true -- display incomplete commands |
| 28 | +vim.opt.showmode = true -- display current mode |
| 29 | +vim.opt.linebreak = true -- show line breaks |
| 30 | +vim.opt.wrap = true -- wrap lines |
| 31 | +vim.opt.title = true -- title in the console |
| 32 | +vim.opt.sm = true -- show matching braces |
| 33 | +vim.opt.ttyfast = true -- smoother changes |
| 34 | +vim.opt.shortmess = "atI" -- abbreviate messages |
| 35 | +vim.opt.backupdir = "/tmp" -- backup directory |
| 36 | +vim.opt.showtabline = 1 -- always show the tab line |
| 37 | +vim.opt.hidden = true -- has to do with undo in buffer I think... |
| 38 | +vim.opt.cursorline = true -- show cursor where my cursor is... |
| 39 | +vim.opt.lazyredraw = true -- better redrawing of text |
| 40 | +vim.opt.termguicolors = true -- 24 bit term gui colors |
| 41 | + |
| 42 | +vim.keymap.set("n", "<leader>1", ":NerdTreeToggle<CR>") |
| 43 | +vim.keymap.set("n", "<leader>2", ":NerdTreeToggle<CR>") |
| 44 | + |
| 45 | +-- autocomplete options |
| 46 | +vim.opt.completeopt=menu,menuone,noselect |
| 47 | + |
| 48 | +-- setup nvim-cmp. |
| 49 | +local cmp = require"cmp" |
| 50 | + |
| 51 | +cmp.setup({ |
| 52 | + snippet = { |
| 53 | + -- REQUIRED - you must specify a snippet engine |
| 54 | + expand = function(args) |
| 55 | + -- vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users. |
| 56 | + require("luasnip").lsp_expand(args.body) -- For `luasnip` users. |
| 57 | + -- require("snippy").expand_snippet(args.body) -- For `snippy` users. |
| 58 | + -- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users. |
| 59 | + end, |
| 60 | + }, |
| 61 | + window = { |
| 62 | + -- completion = cmp.config.window.bordered(), |
| 63 | + -- documentation = cmp.config.window.bordered(), |
| 64 | + }, |
| 65 | + mapping = cmp.mapping.preset.insert({ |
| 66 | + ["<C-b>"] = cmp.mapping.scroll_docs(-4), |
| 67 | + ["<C-f>"] = cmp.mapping.scroll_docs(4), |
| 68 | + ["<C-Space>"] = cmp.mapping.complete(), |
| 69 | + ["<C-e>"] = cmp.mapping.abort(), |
| 70 | + ["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. |
| 71 | + ["<Tab>"] = cmp.mapping.confirm({ select = true }), |
| 72 | + }), |
| 73 | + sources = cmp.config.sources({ |
| 74 | + { name = "nvim_lsp" }, |
| 75 | + -- { name = "vsnip" }, -- For vsnip users. |
| 76 | + { name = "luasnip" }, -- For luasnip users. |
| 77 | + -- { name = "ultisnips" }, -- For ultisnips users. |
| 78 | + -- { name = "snippy" }, -- For snippy users. |
| 79 | + { name = "nvim_lua" }, |
| 80 | + { name = "nvim_lsp_signature_help" }, |
| 81 | + { name = "treesitter" }, |
| 82 | + { name = "path" }, |
| 83 | + }, { |
| 84 | + { name = "buffer" }, |
| 85 | + }) |
| 86 | +}) |
| 87 | + |
| 88 | +-- Set configuration for specific filetype. |
| 89 | +cmp.setup.filetype("gitcommit", { |
| 90 | + sources = cmp.config.sources({ |
| 91 | + { name = "cmp_git" }, -- You can specify the `cmp_git` source if you were installed it. |
| 92 | + }, { |
| 93 | + { name = "buffer" }, |
| 94 | + }) |
| 95 | +}) |
| 96 | + |
| 97 | +-- Use buffer source for `/` (if you enabled `native_menu`, this won"t work anymore). |
| 98 | +cmp.setup.cmdline("/", { |
| 99 | + mapping = cmp.mapping.preset.cmdline(), |
| 100 | + sources = { |
| 101 | + { name = "nvim_lsp_document_symbol" } |
| 102 | + }, { |
| 103 | + { name = "buffer" } |
| 104 | + } |
| 105 | +}) |
| 106 | + |
| 107 | +-- Use cmdline & path source for ":" (if you enabled `native_menu`, this won"t work anymore). |
| 108 | +cmp.setup.cmdline(":", { |
| 109 | +mapping = cmp.mapping.preset.cmdline(), |
| 110 | +sources = cmp.config.sources({ |
| 111 | + { name = "path" } |
| 112 | + }, { |
| 113 | + { name = "cmdline" } |
| 114 | + }) |
| 115 | +}) |
| 116 | + |
| 117 | +-- Setup lspconfig. |
| 118 | +local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()) |
| 119 | + |
| 120 | +-- Replace <YOUR_LSP_SERVER> with each lsp server you"ve enabled. |
| 121 | +require("lspconfig")["pyright"].setup { |
| 122 | + capabilities = capabilities |
| 123 | +} |
0 commit comments