dots-of-war/files/.config/nvim/fnl/init.fnl

154 lines
4.6 KiB
Text
Raw Normal View History

2021-04-03 14:14:56 +00:00
(module init
2021-05-08 18:51:05 +00:00
{autoload {utils utils
nvim aniseed.nvim
a aniseed.core
2021-05-08 20:24:53 +00:00
str aniseed.string
2021-05-08 18:51:05 +00:00
fennel aniseed.fennel
colors colors}
2021-05-01 13:20:02 +00:00
require-macros [macros]})
2021-04-03 18:34:15 +00:00
2021-05-03 20:16:55 +00:00
(macro make-errors-epic [f]
`(xpcall #,f #(a.println (fennel.traceback $1))))
2021-05-09 11:40:11 +00:00
(when (vim.fn.has "termguicolors")
(se termguicolors true))
2021-05-08 17:31:04 +00:00
(make-errors-epic (require "plugins"))
2021-05-06 18:54:55 +00:00
2021-05-03 20:16:55 +00:00
(make-errors-epic (require "plugins.lsp"))
2021-05-06 17:35:35 +00:00
(make-errors-epic (require "keybinds"))
2021-05-03 20:16:55 +00:00
2021-05-08 20:24:53 +00:00
; Basic setup --------------------------------------- foldstart
(vim-let mapleader "\\<Space>")
(vim-let maplocalleader ",")
(vim.cmd "filetype plugin indent on")
(vim.cmd "syntax on")
2021-05-09 09:36:32 +00:00
(se foldmethod "marker")
(se showmode false)
(se undodir (.. vim.env.HOME "/.vim/undo-dir"))
(se undofile true)
(se shortmess (.. vim.o.shortmess "c")) ; Don't give completion messages like 'match 1 of 2' or 'The only match'
(se hidden true)
(se encoding "utf-8")
(se number false)
(se relativenumber false)
(se compatible false)
(se cursorline true)
(se incsearch true)
(se hlsearch true)
(se inccommand "nosplit")
(se signcolumn "yes")
(se shiftwidth 2)
(se tabstop 2)
(se backspace "indent,eol,start")
(se autoindent true)
(se smartindent true)
(se expandtab true)
(se wrap false)
(se completeopt "longest,menuone,noselect")
(se laststatus 2)
(se showmode true)
(se splitbelow true)
(se splitright true)
(se mouse "a")
(se shell "bash")
(se background "dark")
2021-05-08 20:24:53 +00:00
(vim.cmd "colorscheme gruvbox")
(vim-let &t_ut "")
2021-05-09 09:36:32 +00:00
(vim.cmd "autocmd! BufReadPost *.hs :set shiftwidth=2")
2021-05-08 20:24:53 +00:00
(vim.cmd "autocmd! FileType vim setlocal foldmethod=marker")
;Disables automatic commenting on newline)
(vim.cmd "autocmd! FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o")
; Auto-close quickfix list when element is selected)
(vim.cmd "autocmd! FileType qf nnoremap <buffer> <CR> <CR>:cclose<CR>")
2021-05-02 11:54:58 +00:00
2021-05-08 20:24:53 +00:00
; foldend
2021-05-02 11:54:58 +00:00
; Colors ------------------------------------------------------- foldstart
(utils.highlight-add
2021-05-02 15:15:33 +00:00
["GruvboxBlueSign" "GruvboxAquaSign" "GruvboxRedSign" "GruvboxYellowSign" "GruvboxGreenSign" "GruvboxOrangeSign" "GruvboxPurpleSign"]
{:bg "NONE"})
2021-05-02 11:54:58 +00:00
2021-05-08 20:24:53 +00:00
; hide empty line ~'s
(utils.highlight :EndOfBuffer {:bg "NONE" :fg colors.dark0})
(utils.highlight :LineNr {:bg "NONE"})
2021-05-09 11:40:11 +00:00
2021-05-08 20:24:53 +00:00
(utils.highlight-add :Pmenu {:bg colors.dark0_hard})
(utils.highlight-add :PmenuSel {:bg colors.bright_aqua})
(utils.highlight-add :PmenuSbar {:bg colors.dark0_hard})
(utils.highlight-add :PmenuThumb {:bg colors.dark1})
(utils.highlight-add :NormalFloat {:bg colors.dark0_hard})
(utils.highlight-add :SignColumn {:bg colors.dark0})
(vim.cmd "highlight link Function GruvboxGreen")
2021-05-02 11:54:58 +00:00
; foldend
2021-05-01 13:20:02 +00:00
2021-05-08 20:24:53 +00:00
; Plugin config ----------------------- foldstart
(set vim.g.VM_leader "m") ; visual-multi leader
; rust.vim
(set vim.g.rust_clip_command "xclip -selection clipboard")
(set vim.g.rustfmt_autosave 1)
2021-04-30 14:26:31 +00:00
2021-05-08 20:24:53 +00:00
(set vim.g.conjure#client#fennel#aniseed#aniseed_module_prefix "aniseed.")
(set vim.g.vim_parinfer_filetypes ["carp" "fennel"])
; foldend
2021-04-30 16:23:38 +00:00
2021-05-02 10:32:09 +00:00
; :: and _ as space ------------------------------------------------------------------- foldstart
2021-04-23 14:46:45 +00:00
(var remapped-space nil)
(fn _G.RebindShit [newKey]
(set remapped-space {:old (vim.fn.maparg :<Space> :i)
:cur newKey})
(utils.keymap :i :<Space> newKey {:buffer true}))
2021-04-02 17:54:14 +00:00
2021-04-23 14:46:45 +00:00
(fn _G.UnbindSpaceStuff []
2021-05-02 15:15:33 +00:00
(when (and remapped-space (~= remapped-space {}))
2021-05-08 20:24:53 +00:00
(utils.del-keymap :i :<Space> true)
(when (~= remapped-space.old "")
(utils.keymap :i :<Space> remapped-space.old {:buffer true}))
(set remapped-space nil)))
2021-04-23 16:09:31 +00:00
2021-04-23 14:46:45 +00:00
(nvim.command "autocmd! InsertLeave * :call v:lua.UnbindSpaceStuff()")
(utils.keymap :n "<Tab>j" ":call v:lua.RebindShit('_')<CR>")
(utils.keymap :n "<Tab>k" ":call v:lua.RebindShit('::')<CR>")
(utils.keymap :i "<Tab>j" "<space><C-o>:call v:lua.RebindShit('_')<CR>")
(utils.keymap :i "<Tab>k" "<space><C-o>:call v:lua.RebindShit('::')<CR>")
(utils.keymap :n "ö" "a")
2021-04-18 10:03:50 +00:00
2021-05-02 10:32:09 +00:00
; foldend
2021-04-30 14:26:31 +00:00
2021-05-08 20:24:53 +00:00
; :: autoclose empty unnamed buffers ----------------------------------------------- foldstart
(fn _G.clean_no_name_empty_buffers []
2021-05-08 21:41:47 +00:00
(let [bufs (a.filter #(and (a.empty? (vim.fn.bufname $1))
2021-05-08 20:24:53 +00:00
(< (vim.fn.bufwinnr $1) 0)
2021-05-08 21:41:47 +00:00
(vim.api.nvim_buf_is_loaded $1)
(= "" (str.join (utils.buffer-content $1)))
(vim.api.nvim_buf_get_option $1 "buflisted"))
2021-05-08 20:24:53 +00:00
(vim.fn.range 1 (vim.api.nvim_buf_get_number "$")))]
(when (not (a.empty? bufs))
2021-05-08 21:41:47 +00:00
(vim.cmd (.. "bdelete " (str.join " " bufs))))))
2021-05-08 20:24:53 +00:00
2021-05-08 21:41:47 +00:00
(vim.cmd "autocmd! BufCreate * :call v:lua.clean_no_name_empty_buffers()")
2021-05-08 20:24:53 +00:00
; foldend
2021-05-02 11:03:31 +00:00
2021-05-08 20:24:53 +00:00
; vim:foldmarker=foldstart,foldend