init.lua 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. local cmd, g, o = vim.cmd, vim.g, vim.o
  2. -- text/code options
  3. o.hidden = true
  4. o.swapfile = false
  5. o.tabstop = 2
  6. o.softtabstop = 2
  7. o.shiftwidth = 2
  8. o.expandtab = true
  9. o.smarttab = true
  10. o.autoindent = true
  11. o.smartindent = true
  12. cmd.filetype({ args = { "plugin", "indent", "on" } })
  13. cmd.syntax("on")
  14. -- color/UI options
  15. o.splitbelow = true
  16. o.splitright = true
  17. o.background = "dark"
  18. o.number = true
  19. o.list = true
  20. o.listchars = "tab:↦ ,trail:·"
  21. o.colorcolumn = "79,80,99,100,119,120"
  22. o.termguicolors = true
  23. cmd.colorscheme("monokai_pro")
  24. -- menu options (wild mode behaves like bash)
  25. o.wildmode = "longest,list"
  26. o.wildmenu = true
  27. -- globals
  28. g.mapleader = ","
  29. g.maplocalleader = ","
  30. -- key bindings
  31. local function imap(l, r)
  32. vim.keymap.set("i", l, r .. "i", { noremap = true })
  33. end
  34. local function nmap(l, r)
  35. vim.keymap.set("n", l, r, { noremap = true })
  36. end
  37. local function inmap(l, r)
  38. imap(l, r)
  39. nmap(l, r)
  40. end
  41. inmap("<C-Left>", "<Esc>:bprev<Return>")
  42. inmap("<C-Right>", "<Esc>:bnext<Return>")
  43. inmap("<C-Space>", "<Esc>:FZF<Return>")
  44. inmap("<C-LeftMouse>", "<Esc>:ALEGoToDefinition<Return>")
  45. inmap("<F1>", "<Esc>:TagbarToggle<Return>")
  46. nmap("<Leader>slen", "<Esc>:set spell spelllang=en<Return>")
  47. nmap("<Leader>slpt", "<Esc>:set spell spelllang=pt<Return>")
  48. nmap("<Leader>sl0", "<Esc>:set nospell<Return>")
  49. nmap("<Up>", "")
  50. nmap("<Down>", "")
  51. nmap("<Left>", "")
  52. nmap("<Right>", "")
  53. -- mkdir -p .local/share/nvim/pckr
  54. -- cd .local/share/nvim/pckr
  55. -- git clone filter=blob:none https://github.com/lewis6991/pckr.nvim
  56. vim.opt.rtp:prepend(vim.fn.stdpath("data") .. "/pckr/pckr.nvim")
  57. require("pckr").add({
  58. -- ui
  59. "erichain/vim-monokai-pro",
  60. {
  61. "ervandew/supertab",
  62. config_pre = function()
  63. g.SuperTabDefaultCompletionType = "context"
  64. end,
  65. },
  66. {
  67. "ggandor/leap.nvim",
  68. config = function()
  69. nmap("s", "<Plug>(leap)")
  70. end,
  71. },
  72. "junegunn/fzf",
  73. {
  74. "stevearc/oil.nvim",
  75. config = function()
  76. require("oil").setup()
  77. end,
  78. },
  79. "vim-airline/vim-airline-themes",
  80. {
  81. "vim-airline/vim-airline",
  82. config_pre = function()
  83. g.airline_theme = "minimalist"
  84. g["airline#extensions#tabline#enabled"] = 1
  85. end,
  86. },
  87. -- code
  88. "airblade/vim-gitgutter",
  89. {
  90. "dense-analysis/ale",
  91. config_pre = function()
  92. g.ale_completion_enabled = 1
  93. g.ale_fix_on_save = 1
  94. end,
  95. },
  96. {
  97. "numToStr/Comment.nvim",
  98. config = function()
  99. require("Comment").setup()
  100. end,
  101. },
  102. {
  103. "neovim/nvim-lspconfig",
  104. config = function()
  105. require("lspconfig").gopls.setup({ settings = { gopls = { gofumpt = true } } })
  106. end,
  107. },
  108. "nvim-treesitter/nvim-treesitter",
  109. "preservim/tagbar",
  110. -- orgmode
  111. {
  112. "nvim-orgmode/orgmode",
  113. config = function()
  114. require("orgmode").setup({
  115. org_agenda_files = "~/x/plans/notes.orgmode.d/**/*",
  116. org_default_notes_file = "~/x/plans/notes.orgmode.d/inboxes/desktop.org",
  117. })
  118. end,
  119. },
  120. })