summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTyler Davis <tydavis@gmail.com>2022-01-24 16:45:16 +0000
committerTyler Davis <tydavis@gmail.com>2022-01-24 16:45:16 +0000
commita183750f2111a1a9844c8c8d47e12a1b51e32a75 (patch)
tree890da28546993bb123071871842c42e0ef8c4247
parentb216ec0757114240aaec9fbe096540bac86a2f89 (diff)
downloaddotfiles-a183750f2111a1a9844c8c8d47e12a1b51e32a75.tar.gz
dotfiles-a183750f2111a1a9844c8c8d47e12a1b51e32a75.zip
nvim: Move to nested lua files
-rw-r--r--.config/nvim/init.lua86
-rw-r--r--.config/nvim/lua/mappings.lua0
-rw-r--r--.config/nvim/lua/plugins.lua18
-rw-r--r--.config/nvim/lua/settings.lua68
-rw-r--r--.config/nvim/lua/statusline.lua42
5 files changed, 132 insertions, 82 deletions
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua
index 88187e3..3bd72da 100644
--- a/.config/nvim/init.lua
+++ b/.config/nvim/init.lua
@@ -1,82 +1,4 @@
--- Package management
-require "paq" {
- "savq/paq-nvim"; -- Let Paq manage itself
-
- -- LSP
- "neovim/nvim-lspconfig"; -- Mind the semi-colons
- "nvim-lua/lsp_extensions.nvim";
- "nvim-lua/lsp-status.nvim";
- "nvim-lua/completion-nvim";
-
- -- Features
- "jremmen/vim-ripgrep";
- "vim-scripts/DrawIt";
- "rust-lang/rust.vim";
- "fatih/vim-go";
- "nvim-telescope/telescope.nvim";
-}
-
--- Useful globals
-HOME = os.getenv("HOME")
-
--- Core settings
-vim.g.mapleader = '\\'
-
--- Sidebar
-vim.o.number = true -- line number on the left
-vim.o.numberwidth = 2 -- always reserve 2 spaces for line number
-vim.o.signcolumn = 'yes' -- keep 1 column for coc.vim check
-vim.o.modelines = 0
-vim.o.showcmd = true -- display command in bottom bar
-
--- Files and interface
-vim.o.encoding = "utf-8"
-vim.o.backspace = "eol,start,indent" -- backspace works on every char in insert mode
-vim.o.completeopt = 'menuone,noselect'
-vim.o.history = 500
---vim.o.dictionary = '/usr/share/dict/words'
-vim.o.startofline = true
-
-vim.o.expandtab = true -- expand tab to spaces
-vim.o.autoindent = true
-vim.o.smartindent = true
-vim.o.tabstop = 4
-vim.o.shiftwidth = 4 -- indentation rule
-vim.o.shiftround = true
-
--- Display
-vim.o.showmatch = true -- show matching brackets
-vim.o.scrolloff = 7 -- always show 3 rows from edge of the screen
-vim.o.synmaxcol = 250 -- stop syntax highlight after x lines for performance
-vim.o.laststatus = 2 -- always show status line
-
-vim.o.list = false -- do not display white characters
-vim.o.foldenable = false
-vim.o.foldlevel = 4 -- limit folding to 4 levels
-vim.o.foldmethod = 'syntax' -- use language syntax to generate folds
-vim.o.matchtime = 2 -- delay (tenths of seconds) before showing matching paren
-
-vim.o.errorbells = false
-vim.o.visualbell = false
-
--- Search
-vim.o.incsearch = true -- starts searching as soon as typing, without enter needed
-vim.o.ignorecase = true -- ignore letter case when searching
-vim.o.smartcase = true -- case insentive unless capitals used in search
-
--- Colors
-vim.o.background = "light"
--- Can't set some values with lua yet
-vim.cmd [[
- syntax off
- colorscheme peachpuff
-]]
-
--- Backup files
-vim.o.backup = true -- use backup files
-vim.o.writebackup = false
-vim.o.swapfile = false -- do not use swap file
-vim.o.undodir = HOME .. '/.vim/tmp/undo//' -- undo files
-vim.o.backupdir = HOME .. '/.vim/tmp/backup//' -- backups
-vim.o.directory = '/.vim/tmp/swap//' -- swap files
-
+require("plugins")
+require("settings")
+require("mappings")
+require("statusline")
diff --git a/.config/nvim/lua/mappings.lua b/.config/nvim/lua/mappings.lua
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/.config/nvim/lua/mappings.lua
diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua
new file mode 100644
index 0000000..64f60ec
--- /dev/null
+++ b/.config/nvim/lua/plugins.lua
@@ -0,0 +1,18 @@
+require "paq" {
+ "savq/paq-nvim"; -- Let Paq manage itself
+
+ -- LSP
+ "neovim/nvim-lspconfig"; -- Mind the semi-colons
+ "nvim-lua/lsp_extensions.nvim";
+ "nvim-lua/lsp-status.nvim";
+ "nvim-lua/completion-nvim";
+
+ -- Languages
+ "rust-lang/rust.vim";
+ "fatih/vim-go";
+
+ -- Features
+ "jremmen/vim-ripgrep";
+ "vim-scripts/DrawIt";
+ --"nvim-telescope/telescope.nvim";
+}
diff --git a/.config/nvim/lua/settings.lua b/.config/nvim/lua/settings.lua
new file mode 100644
index 0000000..01c0fa8
--- /dev/null
+++ b/.config/nvim/lua/settings.lua
@@ -0,0 +1,68 @@
+-- Settings file
+HOME = os.getenv("HOME")
+
+-- Core settings
+vim.g.mapleader = '\\'
+
+-- Sidebar
+vim.o.number = true -- line number on the left
+vim.o.numberwidth = 2 -- always reserve 2 spaces for line number
+vim.o.signcolumn = 'yes' -- keep 1 column for coc.vim check
+vim.o.modelines = 0
+vim.o.showcmd = true -- display command in bottom bar
+
+-- Files and interface
+vim.o.encoding = "utf-8"
+vim.o.backspace = "eol,start,indent" -- backspace works on every char in insert mode
+vim.o.completeopt = 'menuone,noselect'
+vim.o.history = 500
+--vim.o.dictionary = '/usr/share/dict/words'
+vim.o.startofline = true
+
+vim.o.expandtab = true -- expand tab to spaces
+vim.o.autoindent = true
+vim.o.smartindent = true
+vim.o.tabstop = 4
+vim.o.shiftwidth = 4 -- indentation rule
+vim.o.shiftround = true
+
+-- Display
+vim.o.showmatch = true -- show matching brackets
+vim.o.scrolloff = 7 -- always show 3 rows from edge of the screen
+vim.o.synmaxcol = 250 -- stop syntax highlight after x lines for performance
+vim.o.laststatus = 2 -- always show status line
+
+vim.o.list = false -- do not display white characters
+vim.o.foldenable = false
+vim.o.foldlevel = 4 -- limit folding to 4 levels
+vim.o.foldmethod = 'syntax' -- use language syntax to generate folds
+vim.o.matchtime = 2 -- delay (tenths of seconds) before showing matching paren
+
+vim.o.errorbells = false
+vim.o.visualbell = false
+
+-- Search
+vim.o.incsearch = true -- starts searching as soon as typing, without enter needed
+vim.o.ignorecase = true -- ignore letter case when searching
+vim.o.smartcase = true -- case insentive unless capitals used in search
+
+-- Colors
+vim.o.background = "light"
+-- Can't set some values with lua yet
+vim.cmd [[
+ syntax off
+ colorscheme peachpuff
+]]
+
+-- Backup files
+vim.o.backup = true -- use backup files
+vim.o.writebackup = false
+vim.o.swapfile = false -- do not use swap file
+vim.o.undodir = HOME .. '/.vim/tmp/undo//' -- undo files
+vim.o.backupdir = HOME .. '/.vim/tmp/backup//' -- backups
+vim.o.directory = '/.vim/tmp/swap//' -- swap files
+
+-- Command Mode
+vim.o.wildmenu = true -- on TAB, complete options for system command
+vim.o.wildignore = 'deps,.svn,CVS,.git,.hg,*.o,*.a,*.class,*.mo,*.la,*.so,*.obj,*.swp,*.jpg,*.png,*.xpm,*.gif,.DS_Store,*.aux,*.out,*.toc'
+
diff --git a/.config/nvim/lua/statusline.lua b/.config/nvim/lua/statusline.lua
new file mode 100644
index 0000000..d510532
--- /dev/null
+++ b/.config/nvim/lua/statusline.lua
@@ -0,0 +1,42 @@
+-- Lua statusline imported into the main init
+
+local fn = vim.fn
+local api = vim.api
+
+local modes = {
+ ["n"] = "NORMAL",
+ ["no"] = "NORMAL",
+ ["v"] = "VISUAL",
+ ["V"] = "VISUAL LINE",
+ [""] = "VISUAL BLOCK",
+ ["s"] = "SELECT",
+ ["S"] = "SELECT LINE",
+ [""] = "SELECT BLOCK",
+ ["i"] = "INSERT",
+ ["ic"] = "INSERT",
+ ["R"] = "REPLACE",
+ ["Rv"] = "VISUAL REPLACE",
+ ["c"] = "COMMAND",
+ ["cv"] = "VIM EX",
+ ["ce"] = "EX",
+ ["r"] = "PROMPT",
+ ["rm"] = "MOAR",
+ ["r?"] = "CONFIRM",
+ ["!"] = "SHELL",
+ ["t"] = "TERMINAL",
+}
+
+-- Original Statusline
+vim.cmd [[
+ set statusline=
+ set statusline+=%7*\[%n] "buffernr
+ set statusline+=%1*\ %<%t\ "File+path
+ set statusline+=%3*\ %y\ "FileType
+ set statusline+=%4*\ %{''.(&fenc!=''?&fenc:&enc).''} "Encoding
+ set statusline+=%5*\ %{(&bomb?\",BOM\":\"\")}\ "Encoding2
+ set statusline+=%6*\ %{&ff}\ "FileFormat (dos/unix..)
+ set statusline+=%7*\ %=\ row:%l/%L\ (%03p%%)\ "Rownumber/total (%)
+ set statusline+=%9*\ col:%03c\ "Colnr
+ set statusline+=%0*\ %m%r%w\ "Modified? Readonly? Top/bot.
+]]
+--