diff --git a/.config/nvim/.gitignore b/.config/nvim/.gitignore index 651614d..abbe129 100644 --- a/.config/nvim/.gitignore +++ b/.config/nvim/.gitignore @@ -1,3 +1,4 @@ lua/plugins.lua +lua/settings.lua lua/tangerine_vimrc.lua plugin/packer_compiled.lua diff --git a/.config/nvim/fnl/macros.fnl b/.config/nvim/fnl/macros.fnl new file mode 100644 index 0000000..6b3bb8c --- /dev/null +++ b/.config/nvim/fnl/macros.fnl @@ -0,0 +1,4 @@ +(fn setup [module args] + `((. (require ,module) :setup) ,args)) + +{: setup} diff --git a/.config/nvim/fnl/settings.fnl b/.config/nvim/fnl/settings.fnl new file mode 100644 index 0000000..1afbcfb --- /dev/null +++ b/.config/nvim/fnl/settings.fnl @@ -0,0 +1,172 @@ +(import-macros {: g! : exec : map! : set!} :hibiscus.vim) +(import-macros {: setup} :macros) + +; Theme +(g! :solarized_italic_comments true) +(g! :solarized_italic_keywords true) +(g! :solarized_italic_functions true) +(g! :solarized_italic_variables false) +(g! :solarized_contrast true) +(g! :solarized_borders false) +(g! :solarized_disable_background false) +((. (require :solarized) :set)) + +(require :popup) + +; TreeSitter +(setup :nvim-treesitter.configs { + :ensure_installed [:c :lua :rust :java :python :javascript :typescript :fennel] + :sync_install false + :ignore_install [] + :highlight {:enable true + :disable [] + :additional_vim_regex_highlighting false}}) + +; Feline +(setup :feline { + :theme (require :feline.feline-solarized) + :force_inactive {:filetypes ["^neo\\-tree$" + "^aerial$" + "^packer$" + "^startify$" + "^fugitive$" + "^fugitiveblame$" + "^qf$" + "^help$" + "^DiffviewFileHistory"] + :buftypes ["^terminal$"] + :bufnames ["neo\\-.*"]}}) + +; Window picker +(setup :window-picker { + :autoselect_one true + :selection_chars "ABCDEFGHIJKLMNOP" + :filter_rules {:bo {:filetype [:NvimTree :neo-tree :notify :aerial] + :buftype [:terminal]}}}) + +; NeoTree +(g! :neo_tree_remove_legacy_commands 1) +(setup :neo-tree { + :close_if_last_window true + :window {:width 30 + :mappings {: "open_with_window_picker" + :S "split_with_window_picker" + :s "vsplit_with_window_picker"}} + :filesystem {:filtered_items {:visible true} + :follow_current_file true + :window {:mappings {:/ "noop" + :g/ "fuzzy_finder" + :f "noop" + :ff (fn [] (exec [[:Telescope "find_files"]])) + :fg (fn [] (exec [[:Telescope "live_grep"]])) + : (fn []) + : (fn [])}}} + :renderers {:directory [[:indent] + [:icon] + [:current_filter] + [:name] + [:clipboard] + {1 "diagnostics" :errors_only true}] + :file [[:indent] + [:icon] + {1 "name" :use_git_status_colors true :zindex 10} + [:clipboard] + [:bufnr] + [:modified] + [:diagnostics] + [:git_status]]}}) +(map! [n] :f ":Neotree focus") + +; Smart splits +(local smart-splits (require :smart-splits)) +(map! [n] : smart-splits.move_cursor_left) +(map! [n] : smart-splits.move_cursor_down) +(map! [n] : smart-splits.move_cursor_up) +(map! [n] : smart-splits.move_cursor_right) +(map! [n] : smart-splits.resize_up) +(map! [n] : smart-splits.resize_down) +(map! [n] : smart-splits.resize_left) +(map! [n] : smart-splits.resize_right) + +(require :bufdelete) + +; Bufferline +(local colors (require :solarized.colors)) +(setup :bufferline { + :options {:close_command "Bdelete %d" + :right_mouse_command "Bdelete %d" + :offsets [{:filetype "neo-tree" :text "File Explorer" :padding 1} + {:filetype "aerial" :text "Outline" :padding 1}] + :enforce_regular_tabs true + :separator_style "slant"} + :highlights {:separator {:fg colors.bg_alt} + :separator_visible {:fg colors.bg_alt} + :separator_selected {:fg colors.bg_alt}}}) +(map! [n] : ":bnext") +(map! [n] : ":bprevious") +(map! [n] :q ":Bdelete") + +(setup :nvim-autopairs {}) + +(setup :gitsigns {}) + +(setup :cinnamon {}) + +; Aerial +(setup :aerial { + :close_behavior "global" + :open_automatic true + :placement_editor_edge true + :width 30 + :on_attach (fn [bufnr] (vim.api.nvim_buf_set_keymap bufnr "n" "t" + ((. (require :map_utils) :lua_fn) (fn [] (vim.tbl_map (fn [buf] (if (= (vim.api.nvim_buf_get_option buf "filetype") "aerial") + (vim.tbl_map (fn [win] (vim.api.nvim_set_current_win win)) + (vim.fn.win_findbuf buf)))) + (vim.api.nvim_list_bufs)))) + {}))}) + +(setup :guess-indent) + +; Telescope +(local actions (require :telescope.actions)) +(setup :telescope { + :defaults {:mappings {:n {:S actions.file_split + :s actions.file_vsplit}} + :get_selection_window (. (require :window-picker) :pick_window)} + :pickers {:find_files {:find_command [:fd "--type" "f" "--strip-cwd-prefix" "--hidden"]} + :live_grep {:vimgrep_arguments ["rg" "--color=never" "--no-heading" "--with-filename" "--line-number" "--column" "--smart-case" "--hidden"]}}}) + +; DiffView +(setup :diffview { + :keymaps {:view {:q ":tabc"} + :file_panel {:q ":tabc"} + :file_history_panel {:q ":tabc"}}}) +(map! [n] :r ":DiffviewOpen") +(map! [n] :R ":DiffviewFileHistory %") + +; Null-LS +(setup :null-ls { + :sources [(. (. (. (require :null-ls) :builtins) :diagnostics) :flake8)]}) + +; VimTex +(g! :vimtex_view_method "zathura") + +; General settings +(g! :maplocalleader ",") +(set! :clipboard "unnamedplus") +(set! :expandtab true) +(set! :fileencoding "utf-8") +(set! :ignorecase true) +(set! :mouse "a") +(set! :showmode false) +(set! :number true) +(set! :shiftwidth 2) +(set! :signcolumn "yes") +(set! :smartcase true) +(set! :spelllang "en") +(set! :tabstop 2) + +; Startup +(if (or (= (vim.fn.expand "%") "") (not= (vim.fn.isdirectory (vim.fn.expand "%")) 0)) + ((. (require :neo-tree.command) :_command) (vim.fn.getcwd)) + ((. (require :neo-tree.command) :_command) "show" (vim.fn.getcwd))) diff --git a/.config/nvim/init.fnl b/.config/nvim/init.fnl index 12b6bc6..6967b83 100644 --- a/.config/nvim/init.fnl +++ b/.config/nvim/init.fnl @@ -1 +1,5 @@ (require :plugins) + +(require :settings) + +(require :lspconfig.settings) diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua deleted file mode 100644 index 6c849b6..0000000 --- a/.config/nvim/init.lua +++ /dev/null @@ -1,265 +0,0 @@ -require 'popup' - - -vim.g.solarized_italic_comments = true -vim.g.solarized_italic_keywords = true -vim.g.solarized_italic_functions = true -vim.g.solarized_italic_variables = false -vim.g.solarized_contrast = true -vim.g.solarized_borders = false -vim.g.solarized_disable_background = false -require('solarized').set() - - -require('nvim-treesitter.configs').setup { - ensure_installed = { "c", "lua", "rust", "java", "python", "javascript", "typescript" }, - sync_install = false, - ignore_install = { }, - - highlight = { - enable = true, - disable = { }, - additional_vim_regex_highlighting = false, - }, -} - - -require('feline').setup { - theme = require('feline.feline-solarized'), - force_inactive = { - filetypes = { - '^neo\\-tree$', - '^aerial$', - '^packer$', - '^startify$', - '^fugitive$', - '^fugitiveblame$', - '^qf$', - '^help$', - '^DiffviewFileHistory' - }, - buftypes = { - '^terminal$' - }, - bufnames = { - 'neo\\-.*', - } - } -} - - -require('lspconfig/settings') - - -require('window-picker').setup({ - autoselect_one = true, - selection_chars = 'ABCDEFGHIJKLMNOP', - filter_rules = { - bo = { - filetype = { 'NvimTree', "neo-tree", "notify", 'aerial' }, - buftype = { 'terminal' } - } - } -}) - -vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]]) -require('neo-tree').setup({ - close_if_last_window = true, - window = { - width = 30, - mappings = { - [""] = "open_with_window_picker", - ["S"] = "split_with_window_picker", - ["s"] = "vsplit_with_window_picker" - } - }, - filesystem = { - filtered_items = { - visible = true - }, - follow_current_file = true, - window = { - mappings = { - ["/"] = "noop", - ["g/"] = "fuzzy_finder", - ["f"] = "noop", - ["ff"] = function() vim.cmd([[Telescope find_files]]) end, - ["fg"] = function() vim.cmd([[Telescope live_grep]]) end, - [""] = function() end, - [""] = function() end - } - } - }, - renderers = { - directory = { - { "indent" }, - { "icon" }, - { "current_filter" }, - { "name" }, - { "clipboard" }, - { "diagnostics", errors_only = true } - }, - file = { - { "indent" }, - { "icon" }, - { - "name", - use_git_status_colors = true, - zindex = 10 - }, - { "clipboard" }, - { "bufnr" }, - { "modified" }, - { "diagnostics" }, - { "git_status" } - } - } -}) -vim.keymap.set("n", "f", "Neotree focus") - - -require('smart-splits') -vim.keymap.set("n", "", require('smart-splits').move_cursor_left) -vim.keymap.set("n", "", require('smart-splits').move_cursor_down) -vim.keymap.set("n", "", require('smart-splits').move_cursor_up) -vim.keymap.set("n", "", require('smart-splits').move_cursor_right) -vim.keymap.set("n", "", require('smart-splits').resize_up) -vim.keymap.set("n", "", require('smart-splits').resize_down) -vim.keymap.set("n", "", require('smart-splits').resize_left) -vim.keymap.set("n", "", require('smart-splits').resize_right) - - -require('bufdelete') - - -local colors = require('solarized.colors') -require('bufferline').setup{ - options = { - close_command = "Bdelete %d", - right_mouse_command = "Bdelete %d", - offsets = { - {filetype = "neo-tree", text = "File Explorer", padding = 1}, - {filetype = "aerial", text = "Outline", padding = 1} - }, - enforce_regular_tabs = true, - separator_style = 'slant' - }, - highlights = { - separator = { - fg = colors.bg_alt - }, - separator_visible = { - fg = colors.bg_alt - }, - separator_selected = { - fg = colors.bg_alt - } - } -} -vim.keymap.set("n", "", "bnext") -vim.keymap.set("n", "", "bprevious") -vim.keymap.set("n", "q", "Bdelete") - - -require('nvim-autopairs').setup() - - -require('gitsigns').setup() - - -require('cinnamon').setup() - - -require('aerial').setup({ - close_behavior = 'global', - open_automatic = true, - placement_editor_edge = true, - width = 30, - on_attach = function(bufnr) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 't', - require('map_utils').lua_fn(function() - vim.tbl_map(function(buf) - if vim.api.nvim_buf_get_option(buf, 'filetype') == 'aerial' then - vim.tbl_map(function(win) - vim.api.nvim_set_current_win(win) - end, vim.fn.win_findbuf(buf)) - end - end, vim.api.nvim_list_bufs()) - end), - {}) - end -}) - - -require('guess-indent').setup() - - -local actions = require("telescope.actions") -require('telescope').setup({ - defaults = { - mappings = { - n = { - ["S"] = actions.file_split, - ["s"] = actions.file_vsplit, - } - }, - get_selection_window = require('window-picker').pick_window - }, - pickers = { - find_files = { - find_command = {"fd", "--type", "f", "--strip-cwd-prefix", "--hidden"} - }, - live_grep = { - vimgrep_arguments = {"rg", "--color=never", "--no-heading", "--with-filename", "--line-number", "--column", "--smart-case", "--hidden"} - }, - } -}) - - -require('diffview').setup({ - keymaps = { - view = { - ["q"] = "tabc" - }, - file_panel = { - ["q"] = "tabc" - }, - file_history_panel = { - ["q"] = "tabc" - } - } -}) -vim.keymap.set("n", "r", "DiffviewOpen") -vim.keymap.set("n", "R", "DiffviewFileHistory %") - - -require("null-ls").setup({ - sources = { - require("null-ls").builtins.diagnostics.flake8 - }, -}) - - -vim.g.vimtex_view_method = 'zathura' - - -vim.g.maplocalleader = ',' -vim.o.clipboard = 'unnamedplus' -vim.o.expandtab = true -vim.o.fileencoding = 'utf-8' -vim.o.ignorecase = true -vim.o.mouse = 'a' -vim.o.showmode = false -vim.o.number = true -vim.o.shiftwidth = 2 -vim.o.signcolumn = 'yes' -vim.o.smartcase = true -vim.o.spelllang = 'en' -vim.o.tabstop = 2 - - -if vim.fn.expand('%') == '' or vim.fn.isdirectory(vim.fn.expand('%')) ~= 0 then - require("neo-tree.command")._command(vim.fn.getcwd()) -else - require("neo-tree.command")._command("show", vim.fn.getcwd()) -end