You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
138 lines
4.6 KiB
138 lines
4.6 KiB
2 years ago
|
(vim.cmd "colorscheme paramount")
|
||
|
|
||
2 years ago
|
(set vim.o.foldlevel 2)
|
||
2 years ago
|
(set vim.o.linebreak true)
|
||
|
(set vim.o.list true)
|
||
|
(set vim.o.listchars
|
||
|
"tab:\\u21e5 ,trail:\\u2423,extends:\\u21c9,precedes:\\u21c7,nbsp:\\u00b7")
|
||
|
|
||
|
(set vim.o.number true)
|
||
|
(set vim.o.showmode false)
|
||
|
(set vim.o.termguicolors true)
|
||
|
(set vim.o.virtualedit :block)
|
||
|
(set vim.o.wildmode "longest:full")
|
||
2 years ago
|
|
||
|
;; search
|
||
2 years ago
|
(set vim.o.gdefault true)
|
||
|
(set vim.o.ignorecase true)
|
||
|
(set vim.o.smartcase true)
|
||
2 years ago
|
|
||
|
(set vim.g.mapleader " ")
|
||
|
|
||
2 years ago
|
;; disable arrow keys
|
||
|
(each [_ v (ipairs [:up :down :left :right])]
|
||
|
(vim.keymap.set :n (.. "<" v ">") :<nop>))
|
||
2 years ago
|
|
||
2 years ago
|
;; quick save
|
||
2 years ago
|
(vim.keymap.set :n "\\\\" ":write<cr>")
|
||
|
(vim.keymap.set :i "\\\\" "<esc>:write<cr>")
|
||
2 years ago
|
|
||
2 years ago
|
;; highlight
|
||
|
(set vim.o.hlsearch false)
|
||
|
; (vim.keymap.set :n :<leader>/ ":nohlsearch<cr>")
|
||
2 years ago
|
|
||
|
;; non-shifted shortcuts for moving the cursor to the start/end of the current line
|
||
|
(vim.keymap.set :n :H "^")
|
||
|
(vim.keymap.set :n :L "$")
|
||
|
|
||
|
;; re-run the last macro
|
||
|
(vim.keymap.set :n :Q "@@")
|
||
2 years ago
|
|
||
2 years ago
|
;;; restore cursor location
|
||
|
|
||
2 years ago
|
;; https://github.com/vim/vim/blob/master/runtime/defaults.vim#L108
|
||
|
(let [{: nvim_command : nvim_create_autocmd : nvim_create_augroup} vim.api
|
||
|
au-group (nvim_create_augroup :nvim-startup {})
|
||
|
cb (fn []
|
||
2 years ago
|
(when (and (< 0 (vim.fn.line "'\""))
|
||
2 years ago
|
(<= (vim.fn.line "'\"") (vim.fn.line "$"))
|
||
|
(not (string.find vim.bo.filetype :commit)))
|
||
|
(nvim_command "normal! g`\"")))]
|
||
2 years ago
|
;; when restoring the cursor, we want to ignore commit filetypes, so
|
||
|
;; we need to manually enable filetype detection to set up those
|
||
|
;; autocommands before creating the autocommand to restore the cursor
|
||
|
;;
|
||
|
;; https://github.com/neovim/neovim/issues/15536#issuecomment-909331778
|
||
|
(nvim_command "filetype plugin indent on")
|
||
|
(nvim_create_autocmd :BufReadPost {:callback cb :group au-group}))
|
||
|
|
||
2 years ago
|
;;; filetype
|
||
|
|
||
|
(set vim.g.do_filetype_lua true)
|
||
|
|
||
2 years ago
|
;;; ftplugins in fennel
|
||
|
|
||
2 years ago
|
;; https://github.com/rktjmp/hotpot.nvim/discussions/41#discussioncomment-3050564
|
||
|
(let [{: nvim_create_autocmd : nvim_create_augroup} vim.api
|
||
|
au-group (nvim_create_augroup :hotpot-ft {})
|
||
|
cb #(pcall require (.. :ftplugin. (vim.fn.expand :<amatch>)))]
|
||
|
(nvim_create_autocmd :FileType {:callback cb :group au-group}))
|
||
|
|
||
2 years ago
|
(require :fzf)
|
||
|
(require :lsp)
|
||
2 years ago
|
|
||
|
;;; diagnostic
|
||
|
|
||
|
(vim.diagnostic.config {:float {:source :if_many :border :rounded}})
|
||
|
|
||
2 years ago
|
;;; lightline
|
||
|
|
||
|
;; https://github.com/itchyny/lightline.vim/issues/168#issuecomment-232183744
|
||
|
(let [colorscheme :powerline
|
||
|
palette-key (.. "lightline#colorscheme#" colorscheme "#palette")
|
||
|
palette (. vim.g palette-key)]
|
||
|
(set vim.g.lightline {: colorscheme})
|
||
|
(each [_ f (ipairs [:normal :inactive :tabline])]
|
||
|
(tset palette f :middle [[:NONE :NONE :NONE :NONE]]))
|
||
|
(tset vim.g palette-key palette))
|
||
|
|
||
2 years ago
|
;;; navic
|
||
|
|
||
|
;; TODO Enable this when 0.8 is released
|
||
|
;; TODO Use fennel for this?
|
||
|
; (set vim.o.winbar "%{%v:lua.require'nvim-navic'.get_location()%}")
|
||
|
|
||
2 years ago
|
;;; netrw
|
||
|
|
||
2 years ago
|
;; https://github.com/tpope/vim-vinegar/issues/13
|
||
2 years ago
|
(set vim.g.netrw_fastbrowse 0)
|
||
|
(set vim.g.netrw_home "~/.nvim_tmp")
|
||
|
|
||
2 years ago
|
;;; treesitter
|
||
2 years ago
|
(let [configs (require :nvim-treesitter.configs)
|
||
|
{: setup} configs]
|
||
2 years ago
|
(setup {:ensure_installed [:fennel :hcl :lua :ruby :rust :typescript]
|
||
2 years ago
|
:sync_install false
|
||
|
:highlight {:enable true :additional_vim_regex_highlighting false}
|
||
2 years ago
|
;; disabling since this is super annoying in Ruby
|
||
|
; :indent {:enable true}
|
||
2 years ago
|
:incremental_selection {:enable true
|
||
|
:keymaps {:init_selection :gnn
|
||
|
:node_incremental :grn
|
||
|
:scope_incremental :grc
|
||
2 years ago
|
:node_decremental :grm}}
|
||
|
:textobjects {:select {:enable true
|
||
|
:lookahead true
|
||
|
:keymaps {:af "@function.outer"
|
||
|
:if "@function.inner"
|
||
|
:ac "@class.outer"
|
||
|
:ic "@class.inner"
|
||
|
:ab "@block.outer"
|
||
2 years ago
|
:ib "@block.inner"
|
||
|
:aa "@parameter.outer"
|
||
|
:ia "@parameter.inner"}}}}))
|
||
2 years ago
|
|
||
2 years ago
|
(set vim.o.foldmethod :expr)
|
||
|
(set vim.o.foldexpr "nvim_treesitter#foldexpr()")
|
||
2 years ago
|
|
||
2 years ago
|
;;; generate help files
|
||
|
|
||
2 years ago
|
;; Load all plugins now.
|
||
|
;; Plugins need to be added to runtimepath before helptags can be generated.
|
||
2 years ago
|
(vim.api.nvim_command :packloadall)
|
||
|
|
||
2 years ago
|
;; Load all of the helptags now, after plugins have been loaded.
|
||
|
;; All messages and errors will be ignored.
|
||
2 years ago
|
(vim.api.nvim_command "silent! helptags ALL")
|
||
2 years ago
|
|