A bunch of changes

This commit is contained in:
Alexander Rosenberg 2023-02-07 20:16:58 -08:00
parent 1cbcabc97b
commit 74898aacff
Signed by: Zander671
GPG Key ID: 5FD0394ADBD72730
2 changed files with 96 additions and 135 deletions

View File

@ -16,9 +16,9 @@
(use! :nvim-treesitter/nvim-treesitter
:config
(setup! :nvim-treesitter.configs
:ensure_installed :all
:sync_install false
:auto_install true
;:ensure_installed :all
;:sync_install false
;:auto_install true
:highlight { :enable true
:additional_vim_regex_highlighting false }
:indent { :enable true }))
@ -39,12 +39,13 @@
(setup! :lualine
:options { :section_separators ""
:component_separators "│" }
:sections { :lualine_x [
{ 1 #(.. "recording @" (vim.fn.reg_recording))
:cond #(not= (# (vim.fn.reg_recording)) 0) }
:encoding
:fileformat
:filetype ]}))
; :sections { :lualine_x [
; { 1 #(.. "recording @" (vim.fn.reg_recording))
; :cond #(not= (# (vim.fn.reg_recording)) 0) }
; :encoding
; :fileformat
; :filetype ]}
))
;; bufferline.nvim
(use! :akinsho/bufferline.nvim
@ -60,43 +61,40 @@
;; telescope (a fuzzy finder)
(use! :nvim-telescope/telescope.nvim
:requires [ :nvim-lua/plenary.nvim ]
:config
(let [builtin (require :telescope.builtin)
actions (require :telescope.actions)]
(setup! :telescope
:defaults {
:mappings {
:i { :<esc> actions.close
:<C-k> actions.move_selection_previous
:<C-j> actions.move_selection_next }
:n { :<C-k> actions.move_selection_previous
:<C-j> actions.move_selection_next }}}
:pickers {
:buffers {
;;:ignore_current_buffer true
:sort_lastused true }})
(bind! :n :<leader>fq builtin.quickfix)
(bind! :n :<leader>fr builtin.registers)
(bind! :n :<leader>fj builtin.jumplist)
(bind! :n :<leader>fa builtin.marks)
(bind! :n :<leader>fh builtin.help_tags)
(bind! :n :<leader>g builtin.live_grep)
(bind! :n :<leader>fg builtin.live_grep)
(bind! :n :<leader>b builtin.buffers)
(bind! :n :gb builtin.buffers)
(bind! :n :<leader>fu builtin.git_status)
(bind! :n :<leader>fm builtin.man_pages)
(bind! :n :<leader>fe builtin.diagnostics)
(bind! :n :<leader>d builtin.loclist)
(bind! :n :<leader>fp builtin.spell_suggest)
(bind! :n :<leader>i builtin.find_files)
(bind! :n :z= builtin.spell_suggest)
:cmd :Telescope
:module :telescope
:requires [ { 1 :nvim-lua/plenary.nvim
:opt true }
{ 1 :nvim-telescope/telescope-ui-select.nvim
:opt true }
{ 1 :nvim-telescope/telescope-fzf-native.nvim
:opt true
:run :make }]
:setup
(bind! :n :<leader>fq "<cmd>Telescope quickfix<cr>")
(bind! :n :<leader>fr "<cmd>Telescope registers<cr>")
(bind! :n :<leader>fj "<cmd>Telescope jumplist<cr>")
(bind! :n :<leader>fa "<cmd>Telescope marks<cr>")
(bind! :n :<leader>fh "<cmd>Telescope help_tags<cr>")
(bind! :n :<leader>g "<cmd>Telescope live_grep<cr>")
(bind! :n :<leader>fg "<cmd>Telescope live_grep<cr>")
(bind! :n :<leader>d "<cmd>Telescope treesitter<cr>")
(bind! :n :<leader>b "<cmd>Telescope buffers<cr>")
(bind! :n :<leader>fu "<cmd>Telescope git_status<cr>")
(bind! :n :<leader>fm "<cmd>Telescope man_pages<cr>")
(bind! :n :<leader>fe "<cmd>Telescope diagnostics<cr>")
(bind! :n :<leader>fl "<cmd>Telescope loclist<cr>")
(bind! :n :<leader>fp "<cmd>Telescope spell_suggest<cr>")
(bind! :n :<leader>fo "<cmd>Telescope vim_options<cr>")
(bind! :n :<leader>c "<cmd>Telescope command_history<cr>")
(bind! :n :<leader>i "<cmd>Telescope find_files<cr>")
(bind! :n :<leader>i "<cmd>Telescope find_files<cr>")
(bind! :n :z= "<cmd>Telescope spell_suggest<cr>")
(fn list-git-or-default []
(let [code (os.execute "git rev-parse --is-inside-work-tree >/dev/null 2>&1")]
(if (= code 0)
(builtin.git_files)
(builtin.find_files))))
(vim.cmd "Telescope git_files")
(vim.cmd "Telescope find_files"))))
(bind! :n :<leader>ff list-git-or-default)
(bind! :n :<leader>u list-git-or-default)
(fn jump-or-open-terminal []
@ -114,65 +112,32 @@
(vim.cmd.terminal)
(= term_count 1)
(vim.cmd.buffer last_id)
(builtin.buffers { :default_text "term://" })))
(bind! :n :<leader>t jump-or-open-terminal)))
;; dressing.nvim nicer vim.ui stuff
(use! :stevearc/dressing.nvim
:after :telescope.nvim
(vim.cmd "Telescope buffers default_text=\"term://\"")))
(bind! :n :<leader>t jump-or-open-terminal)
:config
(setup! :dressing))
;; fzf (a fuzzy finder)
;(use! :ibhagwan/fzf-lua
; :cmd :FzfLua
; :setup
; (bind! :n :<leader>fq "<cmd>FzfLua quickfix<cr>")
; (bind! :n :<leader>fr "<cmd>FzfLua registers<cr>")
; (bind! :n :<leader>fj "<cmd>FzfLua jumps<cr>")
; (bind! :n :<leader>fa "<cmd>FzfLua marks<cr>")
; (bind! :n :<leader>fh "<cmd>FzfLua help_tags<cr>")
; (bind! :n :<leader>g "<cmd>FzfLua live_grep<cr>")
; (bind! :n :<leader>fg "<cmd>FzfLua live_grep<cr>")
; (bind! :n :<leader>G "<cmd>FzfLua grep<cr>")
; (bind! :n :<leader>fG "<cmd>FzfLua grep<cr>")
; (bind! :n :<leader>b "<cmd>FzfLua buffers<cr>")
; (bind! :n :gb "<cmd>FzfLua buffers<cr>")
; (bind! :n :<leader>fu "<cmd>FzfLua git_status<cr>")
; (bind! :n :<leader>fm "<cmd>FzfLua man_pages<cr>")
; (bind! :n :<leader>fe "<cmd>FzfLua diagnostics_document<cr>")
; (bind! :n :<leader>fE "<cmd>FzfLua diagnostics_workspace<cr>")
; (bind! :n :<leader>d "<cmd>FzfLua loclist<cr>")
; (bind! :n :<leader>fp "<cmd>FzfLua spell_suggest<cr>")
; (bind! :n :<leader>i "<cmd>FzfLua files<cr>")
; (bind! :n :z= "<cmd>FzfLua spell_suggest<cr>")
; (fn list-git-or-default []
; (let [code (os.execute "git rev-parse --is-inside-work-tree >/dev/null 2>&1")]
; (if (= code 0)
; (vim.cmd "FzfLua git_files")
; (vim.cmd "FzfLua files"))))
; (bind! :n :<leader>ff list-git-or-default)
; (bind! :n :<leader>u list-git-or-default)
; (fn jump-or-open-terminal []
; "If no terminal buffer exists, create one. Otherwise, open new one."
; (var term_count 0)
; (var last_id 0)
; (var terms [ ])
; (each [_ id (pairs (vim.api.nvim_list_bufs))]
; (let [name (vim.api.nvim_buf_get_name id)]
; (when (vim.startswith name "term://")
; (table.insert terms name)
; (set term_count (+ term_count 1))
; (set last_id id))))
; (if (= term_count 0)
; (vim.cmd.terminal)
; (= term_count 1)
; (vim.cmd.buffer last_id)
; (vim.cmd "FzfLua buffers query=term://")))
; (bind! :n :<leader>t jump-or-open-terminal)
; :config
; (let [fzf (require :fzf-lua)]
; (fzf.register_ui_select)))
(vim.cmd "PackerLoad plenary.nvim")
(vim.cmd "PackerLoad telescope-ui-select.nvim")
(vim.cmd "PackerLoad telescope-fzf-native.nvim")
(let [actions (require :telescope.actions)]
(setup! :telescope
:defaults {
:mappings {
:i { :<esc> actions.close
:<C-k> actions.move_selection_previous
:<C-j> actions.move_selection_next }
:n { :<C-k> actions.move_selection_previous
:<C-j> actions.move_selection_next }}}
:pickers {
:buffers {
;;:ignore_current_buffer true
:sort_lastused true }}
:extensions {
:ui-select [
(module-call! :telescope.themes :get_dropdown)
]
})
(module-call! :telescope :load_extension :ui-select)
(module-call! :telescope :load_extension :fzf)))
;; Nvim surround
(use! :kylechui/nvim-surround
@ -202,6 +167,7 @@
;; Comment.nvim
(use! :numToStr/Comment.nvim
:keys [ :gc :gb ]
:config
(setup! :Comment))
@ -277,7 +243,7 @@
(bind! :n :<leader>ci "<cmd>IconPickerNormal<cr>")
(bind! :n :<leader>cy "<cmd>IconPickerYank<cr>")
:config
;;(vim.cmd "PackerLoad fzf-lua")
(vim.cmd "PackerLoad telescope.nvim")
(setup! :icon-picker
:disable_legacy_commands true))
@ -296,6 +262,7 @@
:cmd [ :Format :FormatWrite ]
:setup
(bind! :n :<leader>o "<cmd>Format<cr>")
(bind! :x :<leader>o ":Format<cr>")
:config
(setup! :formatter
:logging true
@ -335,6 +302,7 @@
;; nvim-jdtls
(use! :mfussenegger/nvim-jdtls
:ft :java
:after :nvim-lspconfig
:config
(module-call! :plugin.jdtls :configure))

View File

@ -2,47 +2,40 @@
(import-macros {: bind!} :macros)
(fn on-attach [_ buf]
(fn on-attach [client buf]
((. (. (require :cmp) :setup) :buffer) {
:sources [{ :name "nvim_lsp" :priority 1 :group 1 }
{ :name "snippy" :priority 1 :group 2 }
{ :name "buffer" :priority 0 :group 3 }
{ :name "path" :priority 0 :group 4 }]})
(bind! :n :gD vim.lsp.buf.declaration buf)
;; (bind! :n :gd vim.lsp.buf.definition buf)
; (bind! :n :gd vim.lsp.buf.definition buf)
(bind! :n :K vim.lsp.buf.hover buf)
;; (bind! :n :gI vim.lsp.buf.implementation buf)
; (bind! :n :gI vim.lsp.buf.implementation buf)
(bind! :n :<C-k> vim.lsp.buf.signature_help buf)
(bind! :n :<leader>wa vim.lsp.buf.add_workspace_folder buf)
(bind! :n :<leader>wr vim.lsp.buf.remove_workspace_folder buf)
(bind! :n :<leader>wl #(print (vim.inspect
(vim.lsp.buf.list_workspace_folders))) buf)
(bind! :n :<leader>D vim.lsp.buf.type_definition buf)
; (bind! :n :<leader>D vim.lsp.buf.type_definition buf)
(bind! :n :<leader>rn vim.lsp.buf.rename buf)
(bind! :n :<leader>cn vim.lsp.buf.code_action buf)
; (bind! :n :gr vim.lsp.buf.references buf)
; (bind! :n :<leader>o #(vim.lsp.buf.format { :async true }) buf)
;; Some fzf commands
;(bind! :n :gr "<cmd>FzfLua lsp_references<cr>" buf)
;(bind! :n :<leader>s "<cmd>FzfLua lsp_live_workspace_symbols<cr>" buf)
;(bind! :n :<leader>fs "<cmd>FzfLua lsp_live_workspace_symbols<cr>" buf)
;(bind! :n :<leader>fS "<cmd>FzfLua lsp_workspace_symbols<cr>" buf)
;(bind! :n :<leader>d "<cmd>FzfLua lsp_document_symbols<cr>" buf)
;(bind! :n :<leader>fd "<cmd>FzfLua lsp_document_symbols<cr>" buf)
;(bind! :n :<leader>cn "<cmd>FzfLua lsp_code_actions<cr>" buf)
;(when client.server_capabilities.documentFormattingProvider
; (bind! :n :<leader>o #(vim.lsp.buf.format { :async true }) buf))
;; Some telescope commands
(let [builtin (require :telescope.builtin)]
(bind! :n :gr builtin.lsp_references buf)
(bind! :n :<leader>s builtin.lsp_live_workspace_symbols buf)
(bind! :n :<leader>fs builtin.lsp_live_workspace_symbols buf)
(bind! :n :<leader>fS builtin.lsp_workspace_symbols buf)
(bind! :n :<leader>d builtin.lsp_document_symbols buf)
(bind! :n :<leader>fd builtin.lsp_document_symbols buf)
(bind! :n :<leader>cn builtin.lsp_code_actions buf)
(bind! :n :gd vim.lsp.buf.definition buf)
(bind! :n :gI vim.lsp.buf.implementation buf)))
(bind! :n :<leader>s "<cmd>Telescope lsp_dynamic_workspace_symbols<cr>" buf)
(bind! :n :<leader>fs "<cmd>Telescope lsp_dynamic_workspace_symbols<cr>" buf)
(bind! :n :<leader>fS "<cmd>Telescope lsp_workspace_symbols<cr>" buf)
;(print (vim.inspect client.server_capabilities))
(when client.server_capabilities.documentSymbolProvider
(bind! :n :<leader>d "<cmd>Telescope lsp_document_symbols<cr>" buf)
(bind! :n :<leader>fd "<cmd>Telescope lsp_document_symbols<cr>" buf))
(bind! :n :gr "<cmd>Telescope lsp_references<cr>" buf)
(bind! :n :gd "<cmd>Telescope lsp_definitions<cr>" buf)
(bind! :n :gI "<cmd>Telescope lsp_implementations<cr>" buf)
(bind! :n :D "<cmd>Telescope lsp_type_definitions<cr>" buf))
(fn get-data-dir [server root]